flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Windows > CreateProcess > Regedit.exe

Author
Thread Post new topic Reply to topic
DarkLordTed



Joined: 25 Nov 2017
Posts: 14

CreateProcess > Regedit.exe

I made a little DLL that tries to run Regedit.exe. I set the correct size of StartupInfo. When I run cmd.exe or notepad.exe everything is ok. But if I try to run regedit.exe / regedt32.exe -> nothing happens. It is not necessary to be a DLL but I just use its ready structure for a testing. Any idea?
Post 12 Jan 2018, 19:30
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15378
Location: 77256 23rd Street

Show your code.
Post 13 Jan 2018, 01:16
View user's profile Send private message Visit poster's website Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 682
Location: Adelaide

regedit needs elevation?
Post 13 Jan 2018, 02:25
View user's profile Send private message Reply with quote
Ali.A



Joined: 08 Jan 2018
Posts: 9

whats the point of running regedit?
if your aim to read/write or create a reg key, then hook advapi32.dll
bunch of functions related to registry keys, i did it once while ago for test purpose i dont even remember which function i hooked.

but here is the link:
msdn advapi32.dll functions
Post 13 Jan 2018, 10:36
View user's profile Send private message Reply with quote
DarkLordTed



Joined: 25 Nov 2017
Posts: 14

This is my source code. I don't need to change registry. I just need to understand why can not
run regedit.exe but can run notepad.exe. How to make elevation request? When I run regedit.exe UAC request window is displayed automatically. How can I to make this in createProcess?

; DLL library template
format PE DLL

entry DLL_Main_Proc

include '%finc%/win32/win32a.inc'

section '.code' code readable writeable executable


proc DLL_Main_Proc, .hinstDLL, .fdwReason, .lpvReserved
begin

mov eax,00000001h ;True

return

endp


proc CRun,
begin

mov [sinfo.lpDesktop],desk
mov [sinfo.lpReserved],00000000h
mov [sinfo.cb],sizeof.STARTUPINFO

push pinfo
push sinfo
push 00000000h
push 00000000h
push 00000020h
push 00000000h
push 00000000h
push 00000000h
push Cmd_Test
push 00000000h

call [CreateProcess]

ret

endp

section '.idata' import data readable

library kernel32,"KERNEL32.DLL",\
shell32,"SHELL32.DLL",\
user32,"USER32.DLL"

import kernel32,\
CloseHandle,'CloseHandle',\
CreateProcess,'CreateProcessA',\
WinExec,'WinExec'

import shell32,\
ShellExecute,'ShellExecuteA'

import user32,\
MessageBox,'MessageBoxA'

section '.edata' export data readable

export 'C.DLL',\
CRun,'CRun'

section '.data' data readable writeable

sinfo STARTUPINFO
pinfo PROCESS_INFORMATION

Cmd_Test db 'regedit.exe',00h

section '.reloc' fixups data discardable
; Fixup section. You don't have to
; put anything here manually.

if ~ $-$$

dd 00h,08h

end if
Post 15 Jan 2018, 16:46
View user's profile Send private message Reply with quote
Walter



Joined: 26 Jan 2013
Posts: 122

I second sinsi. Run the exe that calls the dll as "Admin".
Post 15 Jan 2018, 22:27
View user's profile Send private message Reply with quote
donn



Joined: 05 Mar 2010
Posts: 72

Found this interesting. I think ShellExecuteEx can require self-elevation, CreateProcess may not be able to?

CreateProcessAsUser and CreateProcessWithLogon
seem like they can logon on with an account with alternate credentials.

Going to look into UAC interactions more soon out of curiosity. Also for CreateProcess: "The new process runs in the security context of the calling process." Would be curious if you could right-click and run your calling process as admin to open regedit.
Post 16 Jan 2018, 04:02
View user's profile Send private message Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 682
Location: Adelaide

Use ShellExecute with the "open" verb, that will open the elevated prompt for regedit.
Post 16 Jan 2018, 05:19
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >

Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2017, Tomasz Grysztar.