Hi everybody,
I wrote the next source:
;-------------------------------------------
IPConfig proc TmpBuff:DWORD
LOCAL TmpWinipcfgOut[256]:byte
LOCAL FHandle:DWORD
LOCAL TmpNumberOfBytesRead:DWORD
LOCAL TmpFileSize:DWORD
LOCAL TmpFileSizeHigh:DWORD

INVOKE RtlZeroMemory, addr TmpWinipcfgOut, 255
INVOKE lstrcpy, ADDR TmpWinipcfgOut, ADDR WindowsDirectory ;WindowsDirectory = 'C:\WINDOWS'
INVOKE lstrcat, ADDR TmpWinipcfgOut, ADDR programname ;programname = '\WINIPCFG.EXE'
INVOKE lstrcat, ADDR TmpWinipcfgOut, ADDR parameters ;parameters = ' -batch -all'
INVOKE CharUpper, ADDR TmpWinipcfgOut

.if processInfo.hProcess!=0
INVOKE CloseHandle, processInfo.hProcess
mov processInfo.hProcess,0
.endif
INVOKE GetStartupInfo, ADDR startInfo
INVOKE CreateProcess, NULL,ADDR TmpWinipcfgOut,NULL,NULL,FALSE,\
NORMAL_PRIORITY_CLASS,\
NULL,NULL,ADDR startInfo,ADDR processInfo

INVOKE CloseHandle, processInfo.hThread

RET
IPConfig endp
;-------------------------------------------
When i start it, winipcfg.exe was run and then i close the windows explorer but it was crashed.
I test it on 7 different computers, but the result was the same. I replace function
"CreateProcess" by
"invoke ShellExecute,0,ADDR open,ADDR TmpWinipcfgOut,NULL,NULL,SW_SHOW" - crash again !!!
I hope somebody help me. I have spectacles but don't see any problem in the source code.
8-)
Posted on 2002-09-04 17:08:47 by martidim
When i start it, winipcfg.exe was run and then i close the windows explorer but it was crashed.


If you could run it, the problem is not in CreateProcess, i think.
Which process handle do you try to close before calling CreateProcess?
You should initialize all members in startInfo structure to zero and then set cb member to the size of structure. If you don't do it, the members will contain garbage if it's local. The result is unpredictable.

Edit: Oops. You have initialized it with GetStartupInfo.
But anyway, if problem appears by process creation, try to zero it before and set cb member.
Posted on 2002-09-05 00:56:42 by Four-F