J
jacob navia
santosh a écrit :
That API will be called from the code that calls main()
and cleans up after main exits!!!! The code that implements
atexit, and calls ExitProcess.
When we compile the above program with visual studio we get
following imports from kernel32.dll:
GetCommandLineA
HeapFree
GetVersionExA
HeapAlloc
GetProcessHeap
GetProcAddress
GetModuleHandleA
ExitProcess <---- see this one?
WriteFile
GetStdHandle
GetModuleFileNameA
RtlUnwindExt
UnhandledExceptionFilter
FreeEnvironmentStringsA
GetEnvironmentStrings
FreeEnvironmentStringsW
WideCharToMultiBytes
GetLastError
GetEnvironmentStringsW
SetHandleCount
GetFileType
GetStartupInfoA
DeleteCriticalSection
FlsGetValue
FlsSetValue
TlsFree
FlsFree
SetLastError
GetCurrentThreadId
FlsAlloc
HeapSetInformation
HeapCreate
QueryPerformanceCounter
GetTickCount
GetCurrentProcessId
GetSystemTimeAsFileTime
LeaveCriticalSection
EnterCriticalSection
TerminateProcess
GetCurrentProcess
SetUnhandledExceptionFilter
IsDebuggerPresent
CaptureContext
LoadLibraryA
InitializeCriticalSection
Sleep
GetCPInfo
GetACP
GetOEMCP
HeapSize
MultiByteToWideChar
GetLocaleInfoA
HeapReAlloc
MapStringA
MapStringW
GetStringTypeA
GetStringTypeW
RtlVirtualUnwind
RtlLookupFunctionEntry
For a compiler writer, you're making mistakes rather abundantly.
In a C program, ExitProcess() is automatically called _only_ when you
link with the standard C library. If you're writing a C program that
uses Win32 APIs but _not_ any standard C functions, then you'll have to
code an explicit ExitProcess() at the end of main().
That API will be called from the code that calls main()
and cleans up after main exits!!!! The code that implements
atexit, and calls ExitProcess.
When we compile the above program with visual studio we get
following imports from kernel32.dll:
GetCommandLineA
HeapFree
GetVersionExA
HeapAlloc
GetProcessHeap
GetProcAddress
GetModuleHandleA
ExitProcess <---- see this one?
WriteFile
GetStdHandle
GetModuleFileNameA
RtlUnwindExt
UnhandledExceptionFilter
FreeEnvironmentStringsA
GetEnvironmentStrings
FreeEnvironmentStringsW
WideCharToMultiBytes
GetLastError
GetEnvironmentStringsW
SetHandleCount
GetFileType
GetStartupInfoA
DeleteCriticalSection
FlsGetValue
FlsSetValue
TlsFree
FlsFree
SetLastError
GetCurrentThreadId
FlsAlloc
HeapSetInformation
HeapCreate
QueryPerformanceCounter
GetTickCount
GetCurrentProcessId
GetSystemTimeAsFileTime
LeaveCriticalSection
EnterCriticalSection
TerminateProcess
GetCurrentProcess
SetUnhandledExceptionFilter
IsDebuggerPresent
CaptureContext
LoadLibraryA
InitializeCriticalSection
Sleep
GetCPInfo
GetACP
GetOEMCP
HeapSize
MultiByteToWideChar
GetLocaleInfoA
HeapReAlloc
MapStringA
MapStringW
GetStringTypeA
GetStringTypeW
RtlVirtualUnwind
RtlLookupFunctionEntry