16位的LPWSTR类型参数转换成32位的DWORD,用win32asm怎么表示?
比如 L"admin"是LPWSTR类型参数,我想转成32位的DWORD
看这里的C代码:
#pragma comment(lib, "Netapi32.lib")
#include <Windows.h>
#include <Lm.h>
int main(int argc, char* argv[])
{
NET_API_STATUS ret = 0;
DWORD dwErr = 0;
USER_INFO_1 oUserInfo;
ZeroMemory(&oUserInfo, sizeof(oUserInfo));
oUserInfo.usri1_name = L"qyl";
oUserInfo.usri1_password=L"fuckyou1!@#$";
oUserInfo.usri1_priv = USER_PRIV_USER;
oUserInfo.usri1_flags = UF_NORMAL_ACCOUNT;
ret = NetUserAdd(NULL, 1, (LPBYTE)(&oUserInfo), &dwErr);
_LOCALGROUP_MEMBERS_INFO_3 oUser;
oUser.lgrmi3_domainandname = oUserInfo.usri1_name;
ret = NetLocalGroupAddMembers(NULL, L"Administrators", 3, (LPBYTE)(&oUser), 1);
return 0;
}
给oUserInfo结构填充数据的时候,这里:
oUserInfo.usri1_name = L"qyl";
参数是 L"qyl",那么用masm32写就怎么表示这样的类型?
下面是偶的问题代码:
.386
.model flat,stdcall
option casemap:none
include windows.inc
include kernel32.inc
include user32.inc
include Netapi32.inc
includelib kernel32.lib
includelib user32.lib
includelib Netapi32.lib
.data
oUserInfo USER_INFO_1<>
oUser LOCALGROUP_MEMBERS_INFO_3<>
szAdmin db "Administrators",0
user db "fuck",0
pass db "fuckyou1!@#$",0
.data?
dwErr DWORD ?
.code
start:
pushad
invoke RtlZeroMemory,addr oUserInfo,sizeof oUserInfo
lea eax,offset user
lea ecx,offset pass
mov oUserInfo.usri1_name,eax
mov oUserInfo.usri1_password,ecx
mov oUserInfo.usri1_priv,USER_PRIV_USER
mov oUserInfo.usri1_flags,UF_NORMAL_ACCOUNT
invoke NetUserAdd,NULL,1,addr oUserInfo,addr dwErr
push oUserInfo.usri1_name
pop oUser.lgrmi3_domainandname
invoke NetLocalGroupAddMembers,NULL,addr szAdmin,3,addr oUser,1
popad
invoke ExitProcess,NULL
end start
求大大帮个小忙
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课