flat assembler
Message board for the users of flat assembler.
  
|  Index
      > Windows > Why HeapSetInformation() always failed? | 
| Author | 
 | 
| revolution 12 Apr 2009, 04:00 Win32 API return values are in the EAX register, not ECX. | |||
|  12 Apr 2009, 04:00 | 
 | 
| nazha 12 Apr 2009, 04:30 sorry, that is my typping error, eax also always zero, why? | |||
|  12 Apr 2009, 04:30 | 
 | 
| sinsi 12 Apr 2009, 04:53 From SDK:     Quote: To enable the low-fragmentation heap when running under a debugger, set the _NO_DEBUG_HEAP environment variable to 1. | |||
|  12 Apr 2009, 04:53 | 
 | 
| nazha 12 Apr 2009, 06:26 thanks, I have added _NO_DEBUG_HEAP, but still get error. do you think the fasm compiled codes are executed in debug mode in default? | |||
|  12 Apr 2009, 06:26 | 
 | 
| f0dder 12 Apr 2009, 08:59 Why are you using magic numbers instead of symbolic constants?
 Have you tried checking the error code from GetLastError on failure? If your HeapFragValue is stored in your code section, try moving it to a writable data section and 4-byte align it - probably not an issue, but sometimes Windows is nazi about alignment (usually for structs, though). | |||
|  12 Apr 2009, 08:59 | 
 | 
| nazha 12 Apr 2009, 10:34 the error is "A device to attached to the system is not functioning".
 actually, I do stored the HeapFragValue in writable data section. | |||
|  12 Apr 2009, 10:34 | 
 | 
| pal 12 Apr 2009, 10:50 Have you checked to make sure that GetProcessHeap() is not null? Have you tried HeapCreate()? | |||
|  12 Apr 2009, 10:50 | 
 | 
| nazha 12 Apr 2009, 11:22 I have tried, got same error. It's curious that same code work well in nasm. | |||
|  12 Apr 2009, 11:22 | 
 | 
| nazha 12 Apr 2009, 13:28 Tomasz should know why, could you see this, could you help? | |||
|  12 Apr 2009, 13:28 | 
 | 
| sinsi 12 Apr 2009, 21:53 Try this:
 Code: format pe gui 5.0    For me, HeapSetInformation returns EAX=1 for '5.0' but 0 for '4.0' | |||
|  12 Apr 2009, 21:53 | 
 | 
| pal 12 Apr 2009, 22:45 Thats weird; is that a fasm error or what? | |||
|  12 Apr 2009, 22:45 | 
 | 
| f0dder 12 Apr 2009, 23:11 Oh, so newer linkers set 5.0 as subsystem?
 Didn't know the PE subsystem was actually used for anything  . And if that's the issue, no, it's not a FASM bug. | |||
|  12 Apr 2009, 23:11 | 
 | 
| Madis731 13 Apr 2009, 06:23 I think the 4.xx was for 2000 and 5.xx is XP so I've always tried to use the latter one. I haven't tested my code in a 2000 machine for a while, but it seemed to work a while back. Btw, Windows 2003 Server (32-bit) is 5.2 to my knowledge. | |||
|  13 Apr 2009, 06:23 | 
 | 
| sinsi 13 Apr 2009, 07:08 2000 (SP4) is 5.0 and XP is 5.1. The SDK says HeapSetInformation needs 2000SP4 or XP. Like f0dder, I didn't realise the subsystem was used - maybe it's a recent (XP+) thing? I tested under win7 beta. | |||
|  13 Apr 2009, 07:08 | 
 | 
| asmfan 13 Apr 2009, 09:53 Works for me on XP SP3+ with 4.0 SS ver. | |||
|  13 Apr 2009, 09:53 | 
 | 
| nazha 13 Apr 2009, 13:52 yes, work now, regardless of 4.0 or 5.0, my OS is xp sp3. my original code was: format PE GUI, no version number. thanks all. | |||
|  13 Apr 2009, 13:52 | 
 | 
| < Last Thread | Next Thread > | 
| Forum Rules: 
 | 
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.