Author Topic: Memory error in Masm32Lib on Windows2008!  (Read 68 times)

morgot

  • Member
  • **
  • Posts: 62
Memory error in Masm32Lib on Windows2008!
« on: July 10, 2020, 08:57:46 AM »
Hello!

I have strange error in masm32lib , only on Windows Server 2008 R2. I don’t know if this is necessary here, whether someone can reproduce the error, but just in case I will write.
It crashes in GlobalFree (called from ucGetCL ). If I nop it - it crashes in CreateProcess.

Program work correctly on Windows 10, Windows Server 2012, but crashes on R2..


Code: [Select]
.486
.model flat,stdcall
option casemap:none


include \masm32\include\windows.inc
include \masm32\macros\macros.asm
uselib kernel32,user32,masm32

.data
s_i STARTUPINFOW <>
p_i PROCESS_INFORMATION <>
szProg dw 256 dup(0)


.code
start:

invoke ucGetCL,addr szProg,255,1
.if eax != 1
invoke StdOut,chr$("Error usage")
invoke StdOut,chr$("this_prog tested_prog")
jmp @ex
.endif


push ebx
xor ebx,ebx
mov s_i.cb,sizeof STARTUPINFOW
invoke CreateProcessW,addr szProg,ebx,ebx,ebx,ebx,ebx,ebx,ebx,addr s_i,addr p_i
pop ebx
.if !eax
fn MessageBox,0,LastError$(),"Last Error Text",MB_OK
jmp @ex
.endif
invoke WaitForSingleObject,p_i.hProcess,INFINITE


@ex:
exit
end start

Sorry for the bad English