Hello,
I'm stuck, could someone help me?

why is it that the existing appz I launch via createprocess show up with the property window instead of starting up normally? I definded everything in my inc. file, I guess it's just one paramter that needs to be changed.

thanks
===code
push offset pinfo
push offset sinfo
push 0h ; curent dir
push 0h ; environm
push 00000010h ; creation flags / new console
push 0h ; inher flag
push 0h ; thread attr
push 0h ; process attr
push 0h ; cmd line
push offset Appname
Call CreateProcessA

===inc file

PINFO struc
pi_hProcess dd 0 ;process handle
pi_hThread dd 0 ;thread handle
pi_dwProcessId dw 0 ;process id
pi_dwThreadId dw 0 ;thread id
PINFO ends

STARTUPINFOA STRUC
cb dw ?
lpReserved db 0
lpDesktop db ?
lpTitle db ?
dwX dw ?
dwY dw ?
dwXSize dw ?
dwYSize dw ?
dwXCountChars dw ?
dwYCountChars dw ?
dwFillAttribute dw ?
dwFlags dw 0020h
wShowWindow dw 01h
cbReserved2 dd ?
lpReserved2 dd ?
hStdInput dd ?
hStdOutput dd ?
hStdError dd ?
STARTUPINFOA ENDS

PS: I used winexec, but it's obsolete... and even with winexec, the appz didn't start up properly
Posted on 2003-01-11 04:49:45 by hk02
it must be something wronf with calling parameters

I do not know if this is it but i have noticed that you have NOT prefixed the
STARTUPINFO structure in the same way you did in PINFO structure...

as you might already know TASM (in MASM compatible mode) dosent like structure members with same name in 2 diffrent structures.

The bad thing is that sometimes such errors (aka inside STRUC definitions) are not reported at all and program is just missbehaving...

Besides you can use:


Call CreateProcessA,param1,param2,param3,...,param_n

instead of :


push param_n
...
push param_1
Call SomeAPIFunction

works like "invoke" but without the ADDR stuff

Have you tested the above stuff in MASM and it works ok? (just to be sure is a TASM thing and not some wrong parameter?
Posted on 2003-01-11 11:42:08 by BogdanOntanu
thanks for your help, BogdanOntanu, I'll check it out.

though I don't think it's the prefixing...

I could make it run in the meantime under tasm32, but only appz load properly. Screensavers still show the property box.

btw I have another major problem: some appz (mainly sharewares) crash when I load them via a command line in my prog. I wrote a command line parser. Example:

Myapp.exe Shareware.exe

myapp loads, then it loads shareware.exe (parses from commandline) and executes it with createprocess.

I thought first it were the registers that I had to set to zero (xor eax,eax) before making the createprocess. But it's only certain appz!!!

any idea?

thanks
Posted on 2003-01-11 13:03:00 by hk02

===inc file

PINFO struc
pi_hProcess dd 0 ;process handle
pi_hThread dd 0 ;thread handle
pi_dwProcessId dw 0 ;process id
pi_dwThreadId dw 0 ;thread id
PINFO ends

STARTUPINFOA STRUC
cb dw ?
lpReserved db 0
lpDesktop db ?
lpTitle db ?
dwX dw ?
dwY dw ?
dwXSize dw ?
dwYSize dw ?
dwXCountChars dw ?
dwYCountChars dw ?
dwFillAttribute dw ?
dwFlags dw 0020h
wShowWindow dw 01h
cbReserved2 dd ?
lpReserved2 dd ?
hStdInput dd ?
hStdOutput dd ?
hStdError dd ?
STARTUPINFOA ENDS
You aren't declaring the structures properly.

In the Windows C++ files, the dw prefix refers to a DWORD, so they should be defined with DD, not DW. Also, the lp prefix indicates a pointer, and all pointers are DWORDs (yes, use DD).

The cbReserved2 is a WORD-sized padding to align lpReserved on a DWORD boundary.

The structure size field cb is a DWORD (define with DD).

The info on STARTUPINFO is here on MSDN:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/startupinfo_str.asp
Posted on 2003-01-12 03:05:23 by tenkey
ok i'll check it out, thanks
Posted on 2003-01-12 04:03:55 by hk02