首页
社区
课程
招聘
[求助]参数类型的转换
发表于: 2007-3-26 19:59 3882

[求助]参数类型的转换

2007-3-26 19:59
3882
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

求大大帮个小忙

[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!

收藏
免费 0
支持
分享
最新回复 (1)
雪    币: 247
活跃值: (11)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
uncode的宽字符表示, 自己写个函数转换一下
2007-3-29 09:20
0
游客
登录 | 注册 方可回帖
返回
//