I’m trying to get the Windows temppath and write it to the registry, but all I get in the registry are squares ?
Code:
tmpFilePath db 256 dup(?)
Get temp path
main PROC
invoke GetTempPath, 255,addr tmpFilePath`
Write to registry
WriteReg PROC
invoke RegCreateKeyExW,HKEY_CURRENT_USER,offset regkey,NULL,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,offset hIDKey,NULL
.IF eax==ERROR_SUCCESS
invoke lstrlenW,offset tmpFilePath
add eax,eax
add eax,2
invoke RegSetValueExW,hIDKey,offset keyname,NULL,REG_SZ,offset buf,eax
invoke RegCloseKey,hIDKey
You need to use GetTempPathW in order to get a file name that is compatible with RegCreateKeyExW.