地狱怪客

windbg dump内存命令 && 添加账号

.writemem d:\test.dump 897f367c 897f6754

 

#include <stdio.h>
#include <windows.h>
#include <lm.h>
#pragma comment(lib,”netapi32″)
void addusers()
{
// 定义USER_INFO_1结构体
USER_INFO_1 ui;
DWORD dwError = 0;
ui.usri1_name = L”hellboy”; // 账户
ui.usri1_password = L”123456″; // 密码
ui.usri1_priv = USER_PRIV_USER;
ui.usri1_home_dir = NULL;
ui.usri1_comment = NULL;
ui.usri1_flags = UF_SCRIPT;
ui.usri1_script_path = NULL;

if(NetUserAdd(NULL, 1, (LPBYTE)&ui, &dwError) == NERR_Success)
{
OutputDebugString(“successfully”);
}
else
{
//添加失败
OutputDebugString(“Fail!”);
}

// 添加用户到administrators组
LOCALGROUP_MEMBERS_INFO_3 account;
account.lgrmi3_domainandname=ui.usri1_name;
if( NetLocalGroupAddMembers(NULL,L”Administrators”,3,(LPBYTE)&account,1) == NERR_Success )
{
//添加成功
OutputDebugString(“Add to Administrators success”);
}
else
{
//添加失败
OutputDebugString(“Add to Administrators Fail!”);
}

return;
}

码字很辛苦,转载请注明来自人生在世《windbg dump内存命令 && 添加账号》

评论