c89 and processes

Does anyone know of functions to enumerate these, it MUST compile in c89 and be usable on WinXP (Win95 would be even better).
I found that the tlhelp32.h does compile under c89 (since that is the latest that VS2010 supports) so I have at least achieved the main goal, I'll later try on Win95 compatibility mode to see if it still operates fine (after I finish typing the reliant functions).
closed account (G309216C)
Hi,

As Awsdert posted Tlhelp32.h it does work under c98.

I would rather suggest you use NT\ZW functions via exporting them through ntdll.dll although it would require advanced knowledge about Windows API but apart from that it would be great deal better it would work in almost all windows this includes all the NT windows family it would be even better but Windows 95 is not NT so sadly it would not work there, although if TlHelp32 works it would be better to use it.

GL
Thanks, I did not consider .NET purely because it cannot be used on Win95 and I'm making a custom framework that I want to support as far back as that system (even if I don't believe it'll be in use for much longer). My knowledge of the Windows API is still newbie grade so I'd rather stick to the simpler stuff for now.
A a side note, entire windows API is C89 compliant. Visual Studio for example does not support C99 even now.
thanks
entire windows API is C89 compliant

Actually, a lot of the Windows headers require Microsoft specific extensions, so it's not compliant to C89 either.

Compiling with the /Za switch (disable language extension) has been no go for some time. I happen to still have Visual Studio 5 (from 1997) on my oldest PC, and windows.h wouldn't compile with the /Za switch even back then.

(Output of compile: VC97 with old SDK from the same year.)

C:\MSSDK97\Include\winnt.h(287) : error C2467: illegal declaration of anonymous 'struct'
C:\MSSDK97\Include\winnt.h(306) : error C2467: illegal declaration of anonymous 'struct'
C:\MSSDK97\Include\winnt.h(1389) : error C2501: '_inline' : missing decl-specifiers
C:\MSSDK97\Include\winnt.h(1389) : error C2239: unexpected token 'identifier' following declaration of '_inline'
C:\MSSDK97\Include\winnt.h(1389) : error C2061: syntax error : identifier 'PVOID'
C:\MSSDK97\Include\winnt.h(1396) : warning C4616: #pragma warning : warning number '0' out of range, must be between '4001' and '4999'
C:\MSSDK97\Include\winnt.h(1431) : error C2204: '_FLOATING_SAVE_AREA' : type definition found within parentheses
C:\MSSDK97\Include\winnt.h(1441) : error C2501: 'FLOATING_SAVE_AREA' : missing decl-specifiers
C:\MSSDK97\Include\winnt.h(1443) : error C2378: 'FLOATING_SAVE_AREA' : redefinition; symbol cannot be overloaded with a typedef
C:\MSSDK97\Include\winnt.h(1443) : error C2239: unexpected token '*' following declaration of 'FLOATING_SAVE_AREA'
C:\MSSDK97\Include\winnt.h(1443) : error C2059: syntax error : '*'
C:\MSSDK97\Include\winnt.h(1495) : error C2501: 'FLOATING_SAVE_AREA' : missing decl-specifiers
C:\MSSDK97\Include\winnt.h(1495) : error C2146: syntax error : missing ';' before identifier 'FloatSave'
...


(the compiler gives up when it gets to the 100th error.)

To be honest, I'm not sure windows.h has ever compiled with the /Za switch.

Andy

(2011)
/Za compiler directive does not compile system headers in VS2010
http://stackoverflow.com/questions/5489326/za-compiler-directive-does-not-compile-system-headers-in-vs2010

(2007)
windows headers should compile with /Za
http://connect.microsoft.com/VisualStudio/feedback/details/310193/windows-headers-should-compile-with-za

(2005)
/Za option
http://microsoft.public.vc.language.narkive.com/XffJmXUk/za-option

...
Last edited on
<pointless follow up removed...>
Last edited on
I'm not too worried about the /Za switch as long as the /TC switch works, windows.h is after all OS specific so code is written to match the system (in the event system is not detected the code defaults to "do nothing" code with warnings).
Topic archived. No new replies allowed.