News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

help with networky thing?

Started by sixleafclover, February 19, 2006, 03:03:40 AM

Previous topic - Next topic

sixleafclover

*LONG RANT*
Really hope this doesnt violate rules...

Ok i was trying to write a program to manage users + user information, seeing as the one in control panel sucks ass (if you look into user structures theres loads of info to control that xp just doesnt let you see).
Anyway i thought first things first, write a function to create a new user. but already i've hit problems:


.486
.model flat, stdcall
option casemap :none   ; case sensitive

include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\netapi32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\netapi32.lib

.data
newuser        db "Newuser",0
newpass        db "Newpass",0

.data?
uniuser         db 512 dup(?)
unipass         db 512 dup(?)
newuserui          USER_INFO_1 <>
errpoint dd ?


.code
start:

invoke MultiByteToWideChar, CP_ACP, NULL, addr newuser, -1, addr uniuser, 512
invoke MultiByteToWideChar, CP_ACP, NULL, addr newpass, -1, addr unipass, 512

mov newuserui.usri1_name, offset uniuser
mov newuserui.usri1_password, offset unipass
mov newuserui.usri1_priv, USER_PRIV_USER
mov newuserui.usri1_home_dir, NULL
mov newuserui.usri1_comment, NULL
mov newuserui.usri1_flags, UF_SCRIPT
mov newuserui.usri1_script_path, NULL
invoke NetUserAdd, NULL, 1, addr newuserui, addr errpoint

invoke ExitProcess,0

end start



The code executes cleanly, doesnt leave anything hanging in memory which i like. But its clear that something arses up halfway through. The new user doesnt show up at all under xp. Also causes a script error in the user control panel in xp. I thought that it just wasnt creating anything, but turns out that i can log in with the credentials. Two problems though in that even after logging in + out i cant see it in xp (and no its not in the hidden users bit of registry..already checked) and its not a "full" limited user, its just a guest, which isnt how it should be after specifying USER_PRIV_USER. I cant change its priviledges or even delete it cos of its invisiblity.


any help would be greatly appreciated...even if its just to help me delete the rogue account.

Thanks