DrPepUr Posted February 2, 2008 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
HVC Posted February 2, 2008 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
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now