DrPepUr 2 Posted February 2, 2008 (edited) I am playing around a little with Masm @ Winasm trying to get the computername I tried this .data?ComputerName db 255 dup(?)lSize db 255 dup(?).Codeinvoke GetComputerName,addr ComputerName,addr lSizeIt compiles and runs but no return, what am I doing wrong? Edited February 2, 2008 by dustyh1981 (see edit history) Share this post Link to post
HVC 2 Posted February 2, 2008 (edited) .data?ComputerName db 255 dup(?)lSize dd ?.codeinvoke RtlZeroMemory, OFFSET ComputerName, SIZEOF ComputerNamemov lSize, SIZEOF ComputerNameinvoke GetComputerName,addr ComputerName,addr lSizeA. iSize needs to be of DWORD size.B. Before calling GetComputerName, iSize needs to hold the size of the buffer pointed by the 1st parameter of the GetComputerName API (in this case, the size of ComputerName buffer).C. After calling GetComputerName, iSize holds the length of the Computer name. Edited February 2, 2008 by HVC (see edit history) Share this post Link to post