diff --git a/reactos/apps/common/crt0.c b/reactos/apps/common/crt0.c index 860e27c2159..d067b7b552e 100644 --- a/reactos/apps/common/crt0.c +++ b/reactos/apps/common/crt0.c @@ -10,8 +10,6 @@ int mainCRTStartup(PWSTR args) { int nRet; - KERNEL32_Init(args); - // SetUnhandledExceptionFilter(NULL); // _fpreset(); diff --git a/reactos/apps/tests/args/makefile b/reactos/apps/tests/args/makefile index 2258ac30f76..19a61f3d630 100644 --- a/reactos/apps/tests/args/makefile +++ b/reactos/apps/tests/args/makefile @@ -1,11 +1,10 @@ -all: args.bin +all: args.exe OBJECTS= ../common/crt0.o args.o LIBS= ../../lib/kernel32/kernel32.a ../../lib/ntdll/ntdll.a -args.bin: $(OBJECTS) $(LIBS) - $(CC) -specs=../../specs -Ttext 0x10000 $(OBJECTS) $(LIBS) -lgcc \ - -o args.exe +args.exe: $(OBJECTS) $(LIBS) + $(CC) -specs=../../specs $(OBJECTS) $(LIBS) -lgcc -o args.exe $(NM) --numeric-sort args.exe > args.sym - ../../ntoskrnl/utils/pe2bin/pe2bin$(EXE_POSTFIX) 0x10000 args.exe \ - args.bin + +include ../../rules.mak diff --git a/reactos/apps/tests/hello/hello.c b/reactos/apps/tests/hello/hello.c index efd6d4c3559..3b0e1e76170 100644 --- a/reactos/apps/tests/hello/hello.c +++ b/reactos/apps/tests/hello/hello.c @@ -1,10 +1,7 @@ -#include -#include -#include +#include - -void main() +int main(int argc, char* argv[]) { - NtDisplayString("Hello world\n"); - ExitProcess(0); + printf("Hello world\n"); + return(0); } diff --git a/reactos/apps/tests/hello/makefile b/reactos/apps/tests/hello/makefile index 3733e54a9ad..cddd84cb4fa 100644 --- a/reactos/apps/tests/hello/makefile +++ b/reactos/apps/tests/hello/makefile @@ -1,9 +1,8 @@ -all: hello.bin +all: hello.exe -OBJECTS = ../common/crt0.o hello.o +OBJECTS = hello.o -hello.bin: $(OBJECTS) - $(LD) -Ttext 0x10000 $(OBJECTS) ../../lib/kernel32/kernel32.a ../../lib/ntdll/ntdll.a -o hello.exe - $(OBJCOPY) -O binary hello.exe hello.bin +hello.exe: $(OBJECTS) $(LIBS) + $(CC) $(OBJECTS) -o hello.exe include ../../rules.mak diff --git a/reactos/drivers/dd/ide/makefile b/reactos/drivers/dd/ide/makefile index 36a6d0093f0..cdb1e768a1f 100644 --- a/reactos/drivers/dd/ide/makefile +++ b/reactos/drivers/dd/ide/makefile @@ -2,15 +2,14 @@ all: ide.sys OBJECTS = ide.o ../../../ntoskrnl/ntoskrnl.a -# --def ide.def --def ide.def ide.sys: $(OBJECTS) - $(DLLTOOL) --dllname ide.sys --output-lib ide.a $(CC) -specs=../../svc_specs -mdll -o junk.tmp -Wl,--defsym,_end=end \ -Wl,--defsym,_edata=__data_end__ -Wl,--defsym,_etext=etext \ -Wl,--base-file,base.tmp $(OBJECTS) - $(RM) junk.tmp $(DLLTOOL) --dllname ide.sys --base-file base.tmp \ - --output-exp temp.exp + --output-exp temp.exp - $(RM) base.tmp - $(CC) --verbose -Wl,--image-base,0x10000 -Wl,-e,_DriverEntry@8 -specs=../../svc_specs -mdll -o ide.sys $(OBJECTS) -Wl,temp.exp + $(CC) --verbose -Wl,--image-base,0x10000 -Wl,-e,_DriverEntry@8 \ + -specs=../../svc_specs -mdll -o ide.sys $(OBJECTS) -Wl,temp.exp - $(RM) temp.exp diff --git a/reactos/include/ddk/rtl.h b/reactos/include/ddk/rtl.h index 308622829a5..f6f4d8ea284 100644 --- a/reactos/include/ddk/rtl.h +++ b/reactos/include/ddk/rtl.h @@ -325,6 +325,15 @@ DWORD RtlNtStatusToDosError(NTSTATUS StatusCode); +BOOL WINAPI RtlDestroyHeap(HANDLE hheap); +LPVOID STDCALL RtlReAllocHeap(HANDLE hheap, DWORD flags, LPVOID ptr, + DWORD size); +HANDLE WINAPI RtlGetProcessHeap(VOID); +BOOL WINAPI RtlLockHeap(HANDLE hheap); +BOOL WINAPI RtlUnlockHeap(HANDLE hheap); +UINT RtlCompactHeap(HANDLE hheap, DWORD flags); +DWORD WINAPI RtlSizeHeap(HANDLE hheap, DWORD flags, PVOID pmem); +BOOL WINAPI RtlValidateHeap(HANDLE hheap, DWORD flags, PVOID pmem); #endif /* __DDK_RTL_H */ diff --git a/reactos/lib/kernel32/k32_specs b/reactos/lib/kernel32/k32_specs new file mode 100644 index 00000000000..096efd6c4c1 --- /dev/null +++ b/reactos/lib/kernel32/k32_specs @@ -0,0 +1,78 @@ +*asm: + + +*asm_final: + + +*cpp: +-remap %(cpp_cpu) %{posix:-D_POSIX_SOURCE} + +*cc1: +%(cc1_spec) + +*cc1plus: + + +*endfile: + + +*link: +%{mwindows:--subsystem windows} %{mdll:--dll -e _DllMainCRTStartup@12} + +*lib: + + +*libgcc: +-lgcc + +*startfile: + + +*switches_need_spaces: + + +*signed_char: +%{funsigned-char:-D__CHAR_UNSIGNED__} + +*predefines: +-Di386 -D_WIN32 -DWIN32 -D__WIN32__ -D__MINGW32__ -DWINNT -D_X86_=1 -D__STDC__=1 -D__stdcall=__attribute__((__stdcall__)) _D_stdcall=__attribute__((__stdcall__)) -D__cdecl=__attribute__((__cdecl__)) -D__declspec(x)=__attribute__((x)) -Asystem(winnt) -Acpu(i386) -Amachine(i386) + +*cross_compile: +1 + +*version: +egcs-2.91.57 + +*multilib: +. ; + +*multilib_defaults: + + +*multilib_extra: + + +*multilib_matches: + + +*linker: +collect2 + +*cpp_486: +%{!ansi:-Di486} -D__i486 -D__i486__ + +*cpp_586: +%{!ansi:-Di586 -Dpentium} -D__i586 -D__i586__ -D__pentium -D__pentium__ + +*cpp_686: +%{!ansi:-Di686 -Dpentiumpro} -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__ + +*cpp_cpu_default: +%(cpp_586) + +*cpp_cpu: +-Acpu(i386) -Amachine(i386) %{!ansi:-Di386} -D__i386 -D__i386__ %{mcpu=i486:%(cpp_486)} %{m486:%(cpp_486)} %{mpentium:%(cpp_586)} %{mcpu=pentium:%(cpp_586)} %{mpentiumpro:%(cpp_686)} %{mcpu=pentiumpro:%(cpp_686)} %{!mcpu*:%{!m486:%{!mpentium*:%(cpp_cpu_default)}}} + +*cc1_cpu: +%{!mcpu*: %{m386:-mcpu=i386 -march=i386} %{mno-486:-mcpu=i386 -march=i386} %{m486:-mcpu=i486 -march=i486} %{mno-386:-mcpu=i486 -march=i486} %{mno-pentium:-mcpu=i486 -march=i486} %{mpentium:-mcpu=pentium} %{mno-pentiumpro:-mcpu=pentium} %{mpentiumpro:-mcpu=pentiumpro}} + diff --git a/reactos/lib/kernel32/kernel32.def b/reactos/lib/kernel32/kernel32.def index 5aa62feec47..e8b924f3098 100644 --- a/reactos/lib/kernel32/kernel32.def +++ b/reactos/lib/kernel32/kernel32.def @@ -30,43 +30,43 @@ ; LIBRARY KERNEL32 EXPORTS -AddAtomA@4 -AddAtomW@4 -AddConsoleAliasA@12 -AddConsoleAliasW@12 +;AddAtomA@4 +;AddAtomW@4 +;AddConsoleAliasA@12 +;AddConsoleAliasW@12 AllocConsole@0 -AreFileApisANSI@0 -BackupRead@28 -BackupSeek@24 -BackupWrite@28 -BaseAttachCompleteThunk@0 -Beep@8 -BeginUpdateResourceA@8 -BeginUpdateResourceW@8 -BuildCommDCBA@8 -BuildCommDCBAndTimeoutsA@12 -BuildCommDCBAndTimeoutsW@12 -BuildCommDCBW@8 -CallNamedPipeA@28 -CallNamedPipeW@28 -ClearCommBreak@4 -ClearCommError@12 -CloseConsoleHandle@4 +;AreFileApisANSI@0 +;BackupRead@28 +;BackupSeek@24 +;BackupWrite@28 +;BaseAttachCompleteThunk@0 +;Beep@8 +;BeginUpdateResourceA@8 +;BeginUpdateResourceW@8 +;BuildCommDCBA@8 +;BuildCommDCBAndTimeoutsA@12 +;BuildCommDCBAndTimeoutsW@12 +;BuildCommDCBW@8 +;CallNamedPipeA@28 +;CallNamedPipeW@28 +;ClearCommBreak@4 +;ClearCommError@12 +;CloseConsoleHandle@4 CloseHandle@4 -CloseProfileUserMapping@0 -CmdBatNotification@4 -CommConfigDialogA@12 -CommConfigDialogW@12 -CompareFileTime@8 -CompareStringA@24 -CompareStringW@24 -ConnectNamedPipe@8 -ConsoleMenuControl@12 -ContinueDebugEvent@12 -ConvertDefaultLocale@4 -CopyFileA@12 -CopyFileW@12 -CreateConsoleScreenBuffer@20 +;CloseProfileUserMapping@0 +;CmdBatNotification@4 +;CommConfigDialogA@12 +;CommConfigDialogW@12 +;CompareFileTime@8 +;CompareStringA@24 +;CompareStringW@24 +;ConnectNamedPipe@8 +;ConsoleMenuControl@12 +;ContinueDebugEvent@12 +;ConvertDefaultLocale@4 +;CopyFileA@12 +;CopyFileW@12 +;CreateConsoleScreenBuffer@20 CreateDirectoryA@8 CreateDirectoryExA@12 CreateDirectoryExW@12 @@ -74,591 +74,591 @@ CreateDirectoryW@8 CreateEventA@16 CreateEventW@16 CreateFileA@28 -CreateFileMappingA@24 -CreateFileMappingW@24 +;CreateFileMappingA@24 +;CreateFileMappingW@24 CreateFileW@28 -CreateIoCompletionPort@16 -CreateMailslotA@16 -CreateMailslotW@16 -CreateMutexA@12 -CreateMutexW@12 -CreateNamedPipeA@32 -CreateNamedPipeW@32 -CreatePipe@16 +;CreateIoCompletionPort@16 +;CreateMailslotA@16 +;CreateMailslotW@16 +;CreateMutexA@12 +;CreateMutexW@12 +;CreateNamedPipeA@32 +;CreateNamedPipeW@32 +;CreatePipe@16 CreateProcessA@40 CreateProcessW@40 CreateRemoteThread@28 -CreateSemaphoreA@16 -CreateSemaphoreW@16 -CreateTapePartition@16 +;CreateSemaphoreA@16 +;CreateSemaphoreW@16 +;CreateTapePartition@16 CreateThread@24 -CreateVirtualBuffer@12 -DebugActiveProcess@4 -DebugBreak@0 -DefineDosDeviceA@12 -DefineDosDeviceW@12 -DeleteAtom@4 +;CreateVirtualBuffer@12 +;DebugActiveProcess@4 +;DebugBreak@0 +;DefineDosDeviceA@12 +;DefineDosDeviceW@12 +;DeleteAtom@4 DeleteCriticalSection@4 -DeleteFileA@4 -DeleteFileW@4 -DeviceIoControl@32 -DisableThreadLibraryCalls@4 -DisconnectNamedPipe@4 -DosDateTimeToFileTime@12 -DuplicateConsoleHandle@16 -DuplicateHandle@28 -EndUpdateResourceA@8 -EndUpdateResourceW@8 -EnterCriticalSection@4 -EnumCalendarInfoA@16 -EnumCalendarInfoW@16 -EnumDateFormatsA@12 -EnumDateFormatsW@12 -EnumResourceLanguagesA@20 -EnumResourceLanguagesW@20 -EnumResourceNamesA@16 -EnumResourceNamesW@16 -EnumResourceTypesA@12 -EnumResourceTypesW@12 -EnumSystemCodePagesA@8 -EnumSystemCodePagesW@8 -EnumSystemLocalesA@8 -EnumSystemLocalesW@8 -EnumTimeFormatsA@12 -EnumTimeFormatsW@12 -EraseTape@12 -EscapeCommFunction@8 +;DeleteFileA@4 +;DeleteFileW@4 +;DeviceIoControl@32 +;DisableThreadLibraryCalls@4 +;DisconnectNamedPipe@4 +;DosDateTimeToFileTime@12 +;DuplicateConsoleHandle@16 +;DuplicateHandle@28 +;EndUpdateResourceA@8 +;EndUpdateResourceW@8 +;EnterCriticalSection@4 +;EnumCalendarInfoA@16 +;EnumCalendarInfoW@16 +;EnumDateFormatsA@12 +;EnumDateFormatsW@12 +;EnumResourceLanguagesA@20 +;EnumResourceLanguagesW@20 +;EnumResourceNamesA@16 +;EnumResourceNamesW@16 +;EnumResourceTypesA@12 +;EnumResourceTypesW@12 +;EnumSystemCodePagesA@8 +;EnumSystemCodePagesW@8 +;EnumSystemLocalesA@8 +;EnumSystemLocalesW@8 +;EnumTimeFormatsA@12 +;EnumTimeFormatsW@12 +;EraseTape@12 +;EscapeCommFunction@8 ExitProcess@4 -ExitThread@4 -ExitVDM@8 -ExpandEnvironmentStringsA@12 -ExpandEnvironmentStringsW@12 -ExpungeConsoleCommandHistoryA@4 -ExpungeConsoleCommandHistoryW@4 -ExtendVirtualBuffer@8 -FatalAppExitA@8 -FatalAppExitW@8 -FatalExit@4 -FileTimeToDosDateTime@12 -FileTimeToLocalFileTime@8 -FileTimeToSystemTime@8 -FillConsoleOutputAttribute@20 -FillConsoleOutputCharacterA@20 -FillConsoleOutputCharacterW@20 -FindAtomA@4 -FindAtomW@4 +;ExitThread@4 +;ExitVDM@8 +;ExpandEnvironmentStringsA@12 +;ExpandEnvironmentStringsW@12 +;ExpungeConsoleCommandHistoryA@4 +;ExpungeConsoleCommandHistoryW@4 +;ExtendVirtualBuffer@8 +;FatalAppExitA@8 +;FatalAppExitW@8 +;FatalExit@4 +;FileTimeToDosDateTime@12 +;FileTimeToLocalFileTime@8 +;FileTimeToSystemTime@8 +;FillConsoleOutputAttribute@20 +;FillConsoleOutputCharacterA@20 +;FillConsoleOutputCharacterW@20 +;FindAtomA@4 +;FindAtomW@4 FindClose@4 -FindCloseChangeNotification@4 -FindFirstChangeNotificationA@12 -FindFirstChangeNotificationW@12 +;FindCloseChangeNotification@4 +;FindFirstChangeNotificationA@12 +;FindFirstChangeNotificationW@12 FindFirstFileA@8 FindFirstFileW@8 -FindNextChangeNotification@4 +;FindNextChangeNotification@4 FindNextFileA@8 FindNextFileW@8 -FindResourceA@12 -FindResourceExA@16 -FindResourceExW@16 -FindResourceW@12 -FlushConsoleInputBuffer@4 -FlushFileBuffers@4 -FlushInstructionCache@12 -FlushViewOfFile@8 -FoldStringA@20 -FoldStringW@20 -FormatMessageA@28 -FormatMessageW@28 -FreeConsole@0 -FreeEnvironmentStringsA@4 -FreeEnvironmentStringsW@4 -FreeLibrary@4 -FreeLibraryAndExitThread@8 -FreeResource@4 -FreeVirtualBuffer@4 -GenerateConsoleCtrlEvent@8 -GetACP@0 -GetAtomNameA@12 -GetAtomNameW@12 -GetBinaryType@8 -GetBinaryTypeA@8 -GetBinaryTypeW@8 -GetCPInfo@8 -GetCommConfig@12 -GetCommMask@8 -GetCommModemStatus@8 -GetCommProperties@8 -GetCommState@8 -GetCommTimeouts@8 -GetCommandLineA@0 -GetCommandLineW@0 -GetCompressedFileSizeA@8 -GetCompressedFileSizeW@8 -GetComputerNameA@8 -GetComputerNameW@8 -GetConsoleAliasA@16 -GetConsoleAliasExesA@8 -GetConsoleAliasExesLengthA@0 -GetConsoleAliasExesLengthW@0 -GetConsoleAliasExesW@8 -GetConsoleAliasW@16 -GetConsoleAliasesA@12 -GetConsoleAliasesLengthA@4 -GetConsoleAliasesLengthW@4 -GetConsoleAliasesW@12 -GetConsoleCP@0 -GetConsoleCommandHistoryA@12 -GetConsoleCommandHistoryLengthA@4 -GetConsoleCommandHistoryLengthW@4 -GetConsoleCommandHistoryW@12 -GetConsoleCursorInfo@8 -GetConsoleDisplayMode@4 -GetConsoleFontInfo@16 -GetConsoleFontSize@8 -GetConsoleHardwareState@12 -GetConsoleInputWaitHandle@0 -GetConsoleMode@8 -GetConsoleOutputCP@0 -GetConsoleScreenBufferInfo@8 -GetConsoleTitleA@8 -GetConsoleTitleW@8 -GetCurrencyFormatA@24 -GetCurrencyFormatW@24 -GetCurrentConsoleFont@12 +;FindResourceA@12 +;FindResourceExA@16 +;FindResourceExW@16 +;FindResourceW@12 +;FlushConsoleInputBuffer@4 +;FlushFileBuffers@4 +;FlushInstructionCache@12 +;FlushViewOfFile@8 +;FoldStringA@20 +;FoldStringW@20 +;FormatMessageA@28 +;FormatMessageW@28 +;FreeConsole@0 +;FreeEnvironmentStringsA@4 +;FreeEnvironmentStringsW@4 +;FreeLibrary@4 +;FreeLibraryAndExitThread@8 +;FreeResource@4 +;FreeVirtualBuffer@4 +;GenerateConsoleCtrlEvent@8 +;GetACP@0 +;GetAtomNameA@12 +;GetAtomNameW@12 +;GetBinaryType@8 +;GetBinaryTypeA@8 +;GetBinaryTypeW@8 +;GetCPInfo@8 +;GetCommConfig@12 +;GetCommMask@8 +;GetCommModemStatus@8 +;GetCommProperties@8 +;GetCommState@8 +;GetCommTimeouts@8 +;GetCommandLineA@0 +;GetCommandLineW@0 +;GetCompressedFileSizeA@8 +;GetCompressedFileSizeW@8 +;GetComputerNameA@8 +;GetComputerNameW@8 +;GetConsoleAliasA@16 +;GetConsoleAliasExesA@8 +;GetConsoleAliasExesLengthA@0 +;GetConsoleAliasExesLengthW@0 +;GetConsoleAliasExesW@8 +;GetConsoleAliasW@16 +;GetConsoleAliasesA@12 +;GetConsoleAliasesLengthA@4 +;GetConsoleAliasesLengthW@4 +;GetConsoleAliasesW@12 +;GetConsoleCP@0 +;GetConsoleCommandHistoryA@12 +;GetConsoleCommandHistoryLengthA@4 +;GetConsoleCommandHistoryLengthW@4 +;GetConsoleCommandHistoryW@12 +;GetConsoleCursorInfo@8 +;GetConsoleDisplayMode@4 +;GetConsoleFontInfo@16 +;GetConsoleFontSize@8 +;GetConsoleHardwareState@12 +;GetConsoleInputWaitHandle@0 +;GetConsoleMode@8 +;GetConsoleOutputCP@0 +;GetConsoleScreenBufferInfo@8 +;GetConsoleTitleA@8 +;GetConsoleTitleW@8 +;GetCurrencyFormatA@24 +;GetCurrencyFormatW@24 +;GetCurrentConsoleFont@12 GetCurrentDirectoryA@8 GetCurrentDirectoryW@8 -GetCurrentProcess@0 -GetCurrentProcessId@0 -GetCurrentThread@0 -GetCurrentThreadId@0 -GetDateFormatA@24 -GetDateFormatW@24 -GetDefaultCommConfigA@12 -GetDefaultCommConfigW@12 -GetDiskFreeSpaceA@20 -GetDiskFreeSpaceW@20 -GetDriveTypeA@4 -GetDriveTypeW@4 -GetEnvironmentStrings@0 -GetEnvironmentStringsA@0 -GetEnvironmentStringsW@0 -GetEnvironmentVariableA@12 -GetEnvironmentVariableW@12 -GetExitCodeProcess@8 -GetExitCodeThread@8 -GetFileAttributesA@4 -GetFileAttributesW@4 -GetFileInformationByHandle@8 -GetFileSize@8 -GetFileTime@16 -GetFileType@4 -GetFullPathNameA@16 -GetFullPathNameW@16 -GetHandleInformation@8 -GetLargestConsoleWindowSize@4 -GetLastError@0 -GetLocalTime@4 -GetLocaleInfoA@16 -GetLocaleInfoW@16 -GetLogicalDriveStringsA@8 -GetLogicalDriveStringsW@8 -GetLogicalDrives@0 -GetMailslotInfo@20 -GetModuleFileNameA@12 -GetModuleFileNameW@12 -GetModuleHandleA@4 -GetModuleHandleW@4 -GetNamedPipeHandleStateA@28 -GetNamedPipeHandleStateW@28 -GetNamedPipeInfo@20 -GetNextVDMCommand@4 -GetNumberFormatA@24 -GetNumberFormatW@24 -GetNumberOfConsoleFonts@0 -GetNumberOfConsoleInputEvents@8 -GetNumberOfConsoleMouseButtons@4 -GetOEMCP@0 -GetOverlappedResult@16 -GetPriorityClass@4 -GetPrivateProfileIntA@16 -GetPrivateProfileIntW@16 -GetPrivateProfileSectionA@16 -GetPrivateProfileSectionNamesA@12 -GetPrivateProfileSectionNamesW@12 -GetPrivateProfileSectionW@16 -GetPrivateProfileStringA@24 -GetPrivateProfileStringW@24 -GetPrivateProfileStructA@20 -GetPrivateProfileStructW@20 -GetProcAddress@8 -GetProcessAffinityMask@12 -GetProcessHeap@0 -GetProcessHeaps@8 -GetProcessShutdownParameters@8 -GetProcessTimes@20 -GetProcessVersion@4 -GetProcessWorkingSetSize@12 -GetProfileIntA@12 -GetProfileIntW@12 -GetProfileSectionA@12 -GetProfileSectionW@12 -GetProfileStringA@20 -GetProfileStringW@20 -GetQueuedCompletionStatus@20 -GetShortPathNameA@12 -GetShortPathNameW@12 -GetStartupInfoA@4 -GetStartupInfoW@4 +;GetCurrentProcess@0 +;GetCurrentProcessId@0 +;GetCurrentThread@0 +;GetCurrentThreadId@0 +;GetDateFormatA@24 +;GetDateFormatW@24 +;GetDefaultCommConfigA@12 +;GetDefaultCommConfigW@12 +;GetDiskFreeSpaceA@20 +;GetDiskFreeSpaceW@20 +;GetDriveTypeA@4 +;GetDriveTypeW@4 +;GetEnvironmentStrings@0 +;GetEnvironmentStringsA@0 +;GetEnvironmentStringsW@0 +;GetEnvironmentVariableA@12 +;GetEnvironmentVariableW@12 +;GetExitCodeProcess@8 +;GetExitCodeThread@8 +;GetFileAttributesA@4 +;GetFileAttributesW@4 +;GetFileInformationByHandle@8 +;GetFileSize@8 +;GetFileTime@16 +;GetFileType@4 +;GetFullPathNameA@16 +;GetFullPathNameW@16 +;GetHandleInformation@8 +;GetLargestConsoleWindowSize@4 +;GetLastError@0 +;GetLocalTime@4 +;GetLocaleInfoA@16 +;GetLocaleInfoW@16 +;GetLogicalDriveStringsA@8 +;GetLogicalDriveStringsW@8 +;GetLogicalDrives@0 +;GetMailslotInfo@20 +;GetModuleFileNameA@12 +;GetModuleFileNameW@12 +;GetModuleHandleA@4 +;GetModuleHandleW@4 +;GetNamedPipeHandleStateA@28 +;GetNamedPipeHandleStateW@28 +;GetNamedPipeInfo@20 +;GetNextVDMCommand@4 +;GetNumberFormatA@24 +;GetNumberFormatW@24 +;GetNumberOfConsoleFonts@0 +;GetNumberOfConsoleInputEvents@8 +;GetNumberOfConsoleMouseButtons@4 +;GetOEMCP@0 +;GetOverlappedResult@16 +;GetPriorityClass@4 +;GetPrivateProfileIntA@16 +;GetPrivateProfileIntW@16 +;GetPrivateProfileSectionA@16 +;GetPrivateProfileSectionNamesA@12 +;GetPrivateProfileSectionNamesW@12 +;GetPrivateProfileSectionW@16 +;GetPrivateProfileStringA@24 +;GetPrivateProfileStringW@24 +;GetPrivateProfileStructA@20 +;GetPrivateProfileStructW@20 +;GetProcAddress@8 +;GetProcessAffinityMask@12 +;GetProcessHeap@0 +;GetProcessHeaps@8 +;GetProcessShutdownParameters@8 +;GetProcessTimes@20 +;GetProcessVersion@4 +;GetProcessWorkingSetSize@12 +;GetProfileIntA@12 +;GetProfileIntW@12 +;GetProfileSectionA@12 +;GetProfileSectionW@12 +;GetProfileStringA@20 +;GetProfileStringW@20 +;GetQueuedCompletionStatus@20 +;GetShortPathNameA@12 +;GetShortPathNameW@12 +;GetStartupInfoA@4 +;GetStartupInfoW@4 GetStdHandle@4 -GetStringTypeA@20 -GetStringTypeExA@20 -GetStringTypeExW@20 -GetStringTypeW@16 -GetSystemDefaultLCID@0 -GetSystemDefaultLangID@0 -GetSystemDirectoryA@8 -GetSystemDirectoryW@8 -GetSystemInfo@4 -GetSystemPowerStatus@4 -GetSystemTime@4 -GetSystemTimeAdjustment@12 -GetSystemTimeAsFileTime@4 -GetTapeParameters@16 -GetTapePosition@20 -GetTapeStatus@4 -GetTempFileNameA@16 -GetTempFileNameW@16 -GetTempPathA@8 -GetTempPathW@8 -GetThreadContext@8 -GetThreadLocale@0 -GetThreadPriority@4 -GetThreadSelectorEntry@12 -GetThreadTimes@20 -GetTickCount@0 -GetTimeFormatA@24 -GetTimeFormatW@24 -GetTimeZoneInformation@4 -GetUserDefaultLCID@0 -GetUserDefaultLangID@0 -GetVDMCurrentDirectories@8 -GetVersion@0 -GetVersionExA@4 -GetVersionExW@4 -GetVolumeInformationA@32 -GetVolumeInformationW@32 -GetWindowsDirectoryA@8 -GetWindowsDirectoryW@8 -GlobalAddAtomA@4 -GlobalAddAtomW@4 -GlobalAlloc@8 -GlobalCompact@4 -GlobalDeleteAtom@4 -GlobalFindAtomA@4 -GlobalFindAtomW@4 -GlobalFix@4 -GlobalFlags@4 -GlobalFree@4 -GlobalGetAtomNameA@12 -GlobalGetAtomNameW@12 -GlobalHandle@4 -GlobalLock@4 -GlobalMemoryStatus@4 -GlobalReAlloc@12 -GlobalSize@4 -GlobalUnWire@4 -GlobalUnfix@4 -GlobalUnlock@4 -GlobalWire@4 -HeapAlloc@12 -HeapCompact@8 -HeapCreate@12 -HeapCreateTagsW@16 -HeapDestroy@4 -HeapExtend@16 -HeapFree@12 -HeapLock@4 -HeapQueryTagW@20 -HeapReAlloc@16 -HeapSize@12 -HeapSummary@12 -HeapUnlock@4 -HeapUsage@20 -HeapValidate@12 -HeapWalk@8 -InitAtomTable@4 -InitializeCriticalSection@4 -InterlockedDecrement@4 -InterlockedExchange@8 -InterlockedIncrement@4 -InvalidateConsoleDIBits@8 -IsBadCodePtr@4 -IsBadHugeReadPtr@8 -IsBadHugeWritePtr@8 -IsBadReadPtr@8 -IsBadStringPtrA@8 -IsBadStringPtrW@8 -IsBadWritePtr@8 -IsDBCSLeadByte@4 -IsDBCSLeadByteEx@8 -IsDebuggerPresent@0 -IsValidCodePage@4 -IsValidLocale@8 -LCMapStringA@24 -LCMapStringW@24 -LeaveCriticalSection@4 -LoadLibraryA@4 -LoadLibraryExA@12 -LoadLibraryExW@12 -LoadLibraryW@4 -LoadModule@8 -LoadResource@8 -LocalAlloc@8 -LocalCompact@4 -LocalFileTimeToFileTime@8 -LocalFlags@4 -LocalFree@4 -LocalHandle@4 -LocalLock@4 -LocalReAlloc@12 -LocalShrink@8 -LocalSize@4 -LocalUnlock@4 -LockFile@20 -LockFileEx@24 -LockResource@4 -MapViewOfFile@20 -MapViewOfFileEx@24 -MoveFileA@8 -MoveFileExA@12 -MoveFileExW@12 -MoveFileW@8 -MulDiv@12 -MultiByteToWideChar@24 -OpenConsoleW@16 -OpenEventA@12 -OpenEventW@12 -OpenFile@12 -OpenFileMappingA@12 -OpenFileMappingW@12 -OpenMutexA@12 -OpenMutexW@12 -OpenProcess@12 -OpenProfileUserMapping@0 -OpenSemaphoreA@12 -OpenSemaphoreW@12 -OutputDebugStringA@4 -OutputDebugStringW@4 -PeekConsoleInputA@16 -PeekConsoleInputW@16 -PeekNamedPipe@24 -PostQueuedCompletionStatus@16 -PrepareTape@12 -PulseEvent@4 -PurgeComm@8 -QueryDosDeviceA@12 -QueryDosDeviceW@12 -QueryPerformanceCounter@4 -QueryPerformanceFrequency@4 -QueryWin31IniFilesMappedToRegistry@16 -RaiseException@16 +;GetStringTypeA@20 +;GetStringTypeExA@20 +;GetStringTypeExW@20 +;GetStringTypeW@16 +;GetSystemDefaultLCID@0 +;GetSystemDefaultLangID@0 +;GetSystemDirectoryA@8 +;GetSystemDirectoryW@8 +;GetSystemInfo@4 +;GetSystemPowerStatus@4 +;GetSystemTime@4 +;GetSystemTimeAdjustment@12 +;GetSystemTimeAsFileTime@4 +;GetTapeParameters@16 +;GetTapePosition@20 +;GetTapeStatus@4 +;GetTempFileNameA@16 +;GetTempFileNameW@16 +;GetTempPathA@8 +;GetTempPathW@8 +;GetThreadContext@8 +;GetThreadLocale@0 +;GetThreadPriority@4 +;GetThreadSelectorEntry@12 +;GetThreadTimes@20 +;GetTickCount@0 +;GetTimeFormatA@24 +;GetTimeFormatW@24 +;GetTimeZoneInformation@4 +;GetUserDefaultLCID@0 +;GetUserDefaultLangID@0 +;GetVDMCurrentDirectories@8 +;GetVersion@0 +;GetVersionExA@4 +;GetVersionExW@4 +;GetVolumeInformationA@32 +;GetVolumeInformationW@32 +;GetWindowsDirectoryA@8 +;GetWindowsDirectoryW@8 +;GlobalAddAtomA@4 +;GlobalAddAtomW@4 +;GlobalAlloc@8 +;GlobalCompact@4 +;GlobalDeleteAtom@4 +;GlobalFindAtomA@4 +;GlobalFindAtomW@4 +;GlobalFix@4 +;GlobalFlags@4 +;GlobalFree@4 +;GlobalGetAtomNameA@12 +;GlobalGetAtomNameW@12 +;GlobalHandle@4 +;GlobalLock@4 +;GlobalMemoryStatus@4 +;GlobalReAlloc@12 +;GlobalSize@4 +;GlobalUnWire@4 +;GlobalUnfix@4 +;GlobalUnlock@4 +;GlobalWire@4 +;HeapAlloc@12 +;HeapCompact@8 +;HeapCreate@12 +;HeapCreateTagsW@16 +;HeapDestroy@4 +;HeapExtend@16 +;HeapFree@12 +;HeapLock@4 +;HeapQueryTagW@20 +;HeapReAlloc@16 +;HeapSize@12 +;HeapSummary@12 +;HeapUnlock@4 +;HeapUsage@20 +;HeapValidate@12 +;HeapWalk@8 +;InitAtomTable@4 +;InitializeCriticalSection@4 +;InterlockedDecrement@4 +;InterlockedExchange@8 +;InterlockedIncrement@4 +;InvalidateConsoleDIBits@8 +;IsBadCodePtr@4 +;IsBadHugeReadPtr@8 +;IsBadHugeWritePtr@8 +;IsBadReadPtr@8 +;IsBadStringPtrA@8 +;IsBadStringPtrW@8 +;IsBadWritePtr@8 +;IsDBCSLeadByte@4 +;IsDBCSLeadByteEx@8 +;IsDebuggerPresent@0 +;IsValidCodePage@4 +;IsValidLocale@8 +;LCMapStringA@24 +;LCMapStringW@24 +;LeaveCriticalSection@4 +;LoadLibraryA@4 +;LoadLibraryExA@12 +;LoadLibraryExW@12 +;LoadLibraryW@4 +;LoadModule@8 +;LoadResource@8 +;LocalAlloc@8 +;LocalCompact@4 +;LocalFileTimeToFileTime@8 +;LocalFlags@4 +;LocalFree@4 +;LocalHandle@4 +;LocalLock@4 +;LocalReAlloc@12 +;LocalShrink@8 +;LocalSize@4 +;LocalUnlock@4 +;LockFile@20 +;LockFileEx@24 +;LockResource@4 +;MapViewOfFile@20 +;MapViewOfFileEx@24 +;MoveFileA@8 +;MoveFileExA@12 +;MoveFileExW@12 +;MoveFileW@8 +;MulDiv@12 +;MultiByteToWideChar@24 +;OpenConsoleW@16 +;OpenEventA@12 +;OpenEventW@12 +;OpenFile@12 +;OpenFileMappingA@12 +;OpenFileMappingW@12 +;OpenMutexA@12 +;OpenMutexW@12 +;OpenProcess@12 +;OpenProfileUserMapping@0 +;OpenSemaphoreA@12 +;OpenSemaphoreW@12 +;OutputDebugStringA@4 +;OutputDebugStringW@4 +;PeekConsoleInputA@16 +;PeekConsoleInputW@16 +;PeekNamedPipe@24 +;PostQueuedCompletionStatus@16 +;PrepareTape@12 +;PulseEvent@4 +;PurgeComm@8 +;QueryDosDeviceA@12 +;QueryDosDeviceW@12 +;QueryPerformanceCounter@4 +;QueryPerformanceFrequency@4 +;QueryWin31IniFilesMappedToRegistry@16 +;RaiseException@16 ReadConsoleA@20 -ReadConsoleInputA@16 -ReadConsoleInputW@16 -ReadConsoleOutputA@20 -ReadConsoleOutputAttribute@20 -ReadConsoleOutputCharacterA@20 -ReadConsoleOutputCharacterW@20 -ReadConsoleOutputW@20 -ReadConsoleW@20 +;ReadConsoleInputA@16 +;ReadConsoleInputW@16 +;ReadConsoleOutputA@20 +;ReadConsoleOutputAttribute@20 +;ReadConsoleOutputCharacterA@20 +;ReadConsoleOutputCharacterW@20 +;ReadConsoleOutputW@20 +;ReadConsoleW@20 ReadFile@20 ReadFileEx@20 -ReadProcessMemory@20 -RegisterConsoleVDM@44 -RegisterWaitForInputIdle@4 -RegisterWowBaseHandlers@4 -RegisterWowExec@4 -ReleaseMutex@4 -ReleaseSemaphore@12 -RemoveDirectoryA@4 -RemoveDirectoryW@4 -ResetEvent@4 -ResumeThread@4 -RtlFillMemory@12 -RtlMoveMemory@12 -RtlUnwind@16 -RtlZeroMemory@8 -ScrollConsoleScreenBufferA@20 -ScrollConsoleScreenBufferW@20 -SearchPathA@24 -SearchPathW@24 -SetCommBreak@4 -SetCommConfig@12 -SetCommMask@8 -SetCommState@8 -SetCommTimeouts@8 -SetComputerNameA@4 -SetComputerNameW@4 -SetConsoleActiveScreenBuffer@4 -SetConsoleCP@4 -SetConsoleCommandHistoryMode@4 -SetConsoleCtrlHandler@8 -SetConsoleCursor@8 -SetConsoleCursorInfo@8 -SetConsoleCursorPosition@8 -SetConsoleDisplayMode@12 -SetConsoleFont@8 -SetConsoleHardwareState@12 -SetConsoleKeyShortcuts@16 -SetConsoleMaximumWindowSize@8 -SetConsoleMenuClose@4 -SetConsoleMode@8 -SetConsoleNumberOfCommandsA@8 -SetConsoleNumberOfCommandsW@8 -SetConsoleOutputCP@4 -SetConsolePalette@12 -SetConsoleScreenBufferSize@8 -SetConsoleTextAttribute@8 -SetConsoleTitleA@4 -SetConsoleTitleW@4 -SetConsoleWindowInfo@12 +;ReadProcessMemory@20 +;RegisterConsoleVDM@44 +;RegisterWaitForInputIdle@4 +;RegisterWowBaseHandlers@4 +;RegisterWowExec@4 +;ReleaseMutex@4 +;ReleaseSemaphore@12 +;RemoveDirectoryA@4 +;RemoveDirectoryW@4 +;ResetEvent@4 +;ResumeThread@4 +;RtlFillMemory@12 +;RtlMoveMemory@12 +;RtlUnwind@16 +;RtlZeroMemory@8 +;ScrollConsoleScreenBufferA@20 +;ScrollConsoleScreenBufferW@20 +;SearchPathA@24 +;SearchPathW@24 +;SetCommBreak@4 +;SetCommConfig@12 +;SetCommMask@8 +;SetCommState@8 +;SetCommTimeouts@8 +;SetComputerNameA@4 +;SetComputerNameW@4 +;SetConsoleActiveScreenBuffer@4 +;SetConsoleCP@4 +;SetConsoleCommandHistoryMode@4 +;SetConsoleCtrlHandler@8 +;SetConsoleCursor@8 +;SetConsoleCursorInfo@8 +;SetConsoleCursorPosition@8 +;SetConsoleDisplayMode@12 +;SetConsoleFont@8 +;SetConsoleHardwareState@12 +;SetConsoleKeyShortcuts@16 +;SetConsoleMaximumWindowSize@8 +;SetConsoleMenuClose@4 +;SetConsoleMode@8 +;SetConsoleNumberOfCommandsA@8 +;SetConsoleNumberOfCommandsW@8 +;SetConsoleOutputCP@4 +;SetConsolePalette@12 +;SetConsoleScreenBufferSize@8 +;SetConsoleTextAttribute@8 +;SetConsoleTitleA@4 +;SetConsoleTitleW@4 +;SetConsoleWindowInfo@12 SetCurrentDirectoryA@4 SetCurrentDirectoryW@4 -SetDefaultCommConfigA@12 -SetDefaultCommConfigW@12 -SetEndOfFile@4 -SetEnvironmentVariableA@8 -SetEnvironmentVariableW@8 -SetErrorMode@4 -SetEvent@4 -SetFileApisToANSI@0 -SetFileApisToOEM@0 -SetFileAttributesA@8 -SetFileAttributesW@8 -SetFilePointer@16 -SetFileTime@16 -SetHandleCount@4 -SetHandleInformation@12 -SetLastConsoleEventActive@0 -SetLastError@4 -SetLocalTime@4 -SetLocaleInfoA@12 -SetLocaleInfoW@12 -SetMailslotInfo@8 -SetNamedPipeHandleState@16 -SetPriorityClass@8 -SetProcessShutdownParameters@8 -SetProcessWorkingSetSize@12 -SetStdHandle@8 -SetSystemPowerState@8 -SetSystemTime@4 -SetSystemTimeAdjustment@8 -SetTapeParameters@12 -SetTapePosition@24 -SetThreadAffinityMask@8 -SetThreadContext@8 -_imp__SetThreadContext@8 -SetThreadLocale@4 -SetThreadPriority@8 -SetTimeZoneInformation@4 -SetUnhandledExceptionFilter@4 -SetVDMCurrentDirectories@8 -SetVolumeLabelA@8 -SetVolumeLabelW@8 -SetupComm@12 -ShowConsoleCursor@8 -SizeofResource@8 -Sleep@4 -SleepEx@8 -SuspendThread@4 -SystemTimeToFileTime@8 -SystemTimeToTzSpecificLocalTime@12 -TerminateProcess@8 -TerminateThread@8 -TlsAlloc@0 -TlsFree@4 -TlsGetValue@4 -TlsSetValue@8 -TransactNamedPipe@28 -TransmitCommChar@8 -TrimVirtualBuffer@4 -UnhandledExceptionFilter@4 -UnlockFile@20 -UnlockFileEx@20 -UnmapViewOfFile@4 -UpdateResourceA@24 -UpdateResourceW@24 -VDMConsoleOperation@8 -VDMOperationStarted@4 -VerLanguageNameA@12 -VerLanguageNameW@12 -VerifyConsoleIoHandle@4 -VirtualAlloc@16 -VirtualBufferExceptionHandler@12 -VirtualFree@12 -VirtualLock@8 -VirtualProtect@16 -VirtualProtectEx@20 -VirtualQuery@12 -VirtualQueryEx@16 -VirtualUnlock@8 -WaitCommEvent@12 -WaitForDebugEvent@8 -WaitForMultipleObjects@16 -WaitForMultipleObjectsEx@20 +;SetDefaultCommConfigA@12 +;SetDefaultCommConfigW@12 +;SetEndOfFile@4 +;SetEnvironmentVariableA@8 +;SetEnvironmentVariableW@8 +;SetErrorMode@4 +;SetEvent@4 +;SetFileApisToANSI@0 +;SetFileApisToOEM@0 +;SetFileAttributesA@8 +;SetFileAttributesW@8 +;SetFilePointer@16 +;SetFileTime@16 +;SetHandleCount@4 +;SetHandleInformation@12 +;SetLastConsoleEventActive@0 +;SetLastError@4 +;SetLocalTime@4 +;SetLocaleInfoA@12 +;SetLocaleInfoW@12 +;SetMailslotInfo@8 +;SetNamedPipeHandleState@16 +;SetPriorityClass@8 +;SetProcessShutdownParameters@8 +;SetProcessWorkingSetSize@12 +;SetStdHandle@8 +;SetSystemPowerState@8 +;SetSystemTime@4 +;SetSystemTimeAdjustment@8 +;SetTapeParameters@12 +;SetTapePosition@24 +;SetThreadAffinityMask@8 +;SetThreadContext@8 +;_imp__SetThreadContext@8 +;SetThreadLocale@4 +;SetThreadPriority@8 +;SetTimeZoneInformation@4 +;SetUnhandledExceptionFilter@4 +;SetVDMCurrentDirectories@8 +;SetVolumeLabelA@8 +;SetVolumeLabelW@8 +;SetupComm@12 +;ShowConsoleCursor@8 +;SizeofResource@8 +;Sleep@4 +;SleepEx@8 +;SuspendThread@4 +;SystemTimeToFileTime@8 +;SystemTimeToTzSpecificLocalTime@12 +;TerminateProcess@8 +;TerminateThread@8 +;TlsAlloc@0 +;TlsFree@4 +;TlsGetValue@4 +;TlsSetValue@8 +;TransactNamedPipe@28 +;TransmitCommChar@8 +;TrimVirtualBuffer@4 +;UnhandledExceptionFilter@4 +;UnlockFile@20 +;UnlockFileEx@20 +;UnmapViewOfFile@4 +;UpdateResourceA@24 +;UpdateResourceW@24 +;VDMConsoleOperation@8 +;VDMOperationStarted@4 +;VerLanguageNameA@12 +;VerLanguageNameW@12 +;VerifyConsoleIoHandle@4 +;VirtualAlloc@16 +;VirtualBufferExceptionHandler@12 +;VirtualFree@12 +;VirtualLock@8 +;VirtualProtect@16 +;VirtualProtectEx@20 +;VirtualQuery@12 +;VirtualQueryEx@16 +;VirtualUnlock@8 +;WaitCommEvent@12 +;WaitForDebugEvent@8 +;WaitForMultipleObjects@16 +;WaitForMultipleObjectsEx@20 WaitForSingleObject@8 -WaitForSingleObjectEx@12 -WaitNamedPipeA@8 -WaitNamedPipeW@8 -WideCharToMultiByte@32 -WinExec@8 +;WaitForSingleObjectEx@12 +;WaitNamedPipeA@8 +;WaitNamedPipeW@8 +;WideCharToMultiByte@32 +;WinExec@8 WriteConsoleA@20 -WriteConsoleInputA@16 -WriteConsoleInputVDMA@16 -WriteConsoleInputVDMW@16 -WriteConsoleInputW@16 -WriteConsoleOutputA@20 -WriteConsoleOutputAttribute@20 -WriteConsoleOutputCharacterA@20 -WriteConsoleOutputCharacterW@20 -WriteConsoleOutputW@20 -WriteConsoleW@20 -WriteFile@20 -WriteFileEx@20 -WritePrivateProfileSectionA@12 -WritePrivateProfileSectionW@12 -WritePrivateProfileStringA@16 -WritePrivateProfileStringW@16 -WritePrivateProfileStructA@20 -WritePrivateProfileStructW@20 -WriteProcessMemory@20 -WriteProfileSectionA@8 -WriteProfileSectionW@8 -WriteProfileStringA@12 -WriteProfileStringW@12 -WriteTapemark@16 -_hread@12 -_hwrite@12 -_lclose@4 -_lcreat@8 -_llseek@12 -_lopen@8 -_lread@12 -_lwrite@12 -lstrcat@8 -lstrcatA@8 -lstrcatW@8 -lstrcmp@8 -lstrcmpA@8 -lstrcmpW@8 -lstrcmpi@8 -lstrcmpiA@8 -lstrcmpiW@8 -lstrcpy@8 -lstrcpyA@8 -lstrcpyW@8 -lstrcpyn@12 -lstrcpynA@12 -lstrcpynW@12 -lstrlen@4 -lstrlenA@4 -lstrlenW@4 +;WriteConsoleInputA@16 +;WriteConsoleInputVDMA@16 +;WriteConsoleInputVDMW@16 +;WriteConsoleInputW@16 +;WriteConsoleOutputA@20 +;WriteConsoleOutputAttribute@20 +;WriteConsoleOutputCharacterA@20 +;WriteConsoleOutputCharacterW@20 +;WriteConsoleOutputW@20 +;WriteConsoleW@20 +;WriteFile@20 +;WriteFileEx@20 +;WritePrivateProfileSectionA@12 +;WritePrivateProfileSectionW@12 +;WritePrivateProfileStringA@16 +;WritePrivateProfileStringW@16 +;WritePrivateProfileStructA@20 +;WritePrivateProfileStructW@20 +;WriteProcessMemory@20 +;WriteProfileSectionA@8 +;WriteProfileSectionW@8 +;WriteProfileStringA@12 +;WriteProfileStringW@12 +;WriteTapemark@16 +;_hread@12 +;_hwrite@12 +;_lclose@4 +;_lcreat@8 +;_llseek@12 +;_lopen@8 +;_lread@12 +;_lwrite@12 +;lstrcat@8 +;lstrcatA@8 +;lstrcatW@8 +;lstrcmp@8 +;lstrcmpA@8 +;lstrcmpW@8 +;lstrcmpi@8 +;lstrcmpiA@8 +;lstrcmpiW@8 +;lstrcpy@8 +;lstrcpyA@8 +;lstrcpyW@8 +;lstrcpyn@12 +;lstrcpynA@12 +;lstrcpynW@12 +;lstrlen@4 +;lstrlenA@4 +;lstrlenW@4 diff --git a/reactos/lib/kernel32/makefile b/reactos/lib/kernel32/makefile index 3169c166264..97cb127ad04 100644 --- a/reactos/lib/kernel32/makefile +++ b/reactos/lib/kernel32/makefile @@ -1,4 +1,15 @@ -all: kernel32.a + +ifneq ($(HOST),mingw32-windows) + ifneq ($(HOST),mingw32-linux) + DLLTARGET=kernel32.a + else + DLLTARGET=kernel32.dll + endif +else + DLLTARGET=kernel32.dll +endif + +all: $(DLLTARGET) SYNCH_OBJECTS = synch/critical.o synch/event.o synch/wait.o @@ -19,7 +30,7 @@ PROCESS_OBJECTS = process/proc.o process/cmdline.o STRING_OBJECTS = string/lstring.o -INTERNAL_OBJECTS = internal/dprintf.o internal/init.o internal/string.o +INTERNAL_OBJECTS = internal/dprintf.o internal/string.o EXCEPT_OBJECTS = except/except.o @@ -27,11 +38,26 @@ EXCEPT_OBJECTS = except/except.o OBJECTS = $(MISC_OBJECTS) $(FILE_OBJECTS) $(THREAD_OBJECTS) \ $(PROCESS_OBJECTS) $(STRING_OBJECTS) $(MEM_OBJECTS) $(NLS_OBJECTS) \ $(INTERNAL_OBJECTS) $(SYNCH_OBJECTS) $(EXCEPT_OBJECTS) - kernel32.a: $(OBJECTS) - $(AR) rcs kernel32.a $(OBJECTS) + $(AR) csr kernel32.a $(OBJECTS) -dummy: +kernel32.dll: $(DLLMAIN) $(OBJECTS) kernel32.def + $(LD) -r $(OBJECTS) -o kernel32.o + $(DLLTOOL) --dllname kernel32.dll --def kernel32.def \ + --output-lib kernel32.a + $(CC) -specs=k32_specs -mdll -o junk.tmp \ + -Wl,--base-file,base.tmp kernel32.o ../ntdll/ntdll.a + - $(RM) junk.tmp + $(DLLTOOL) --dllname kernel32.dll --base-file base.tmp \ + --output-exp temp.exp --def kernel32.def + - $(RM) base.tmp + $(CC) -specs=k32_specs -mdll -o kernel32.dll kernel32.o ../ntdll/ntdll.a\ + -Wl,--image-base,0x70000000 \ + -Wl,--file-alignment,0x1000 \ + -Wl,--section-alignment,0x1000 \ + -Wl,temp.exp + - $(RM) temp.exp + $(NM) --numeric-sort kernel32.dll > kernel32.sym include ../../rules.mak diff --git a/reactos/lib/kernel32/mem/heap.c b/reactos/lib/kernel32/mem/heap.c index c7d3dcdd30f..1cc8ccf5dfa 100644 --- a/reactos/lib/kernel32/mem/heap.c +++ b/reactos/lib/kernel32/mem/heap.c @@ -26,644 +26,19 @@ * Put the type definitions of the heap in a seperate header. Boudewijn Dekker */ -#define NDEBUG -#include - -#include -#include -#include - #include -#define HEAP_VALIDATE - -static HEAP_BUCKET __HeapDefaultBuckets[]= -{ - { NULL, 16, 18, 504 }, - { NULL, 24, 30, 1016 }, - { NULL, 32, 24, 1016 }, - { NULL, 48, 17, 1016 }, - { NULL, 64, 27, 2040 }, - { NULL, 96, 19, 2040 }, - { NULL, 128, 29, 4088 }, - { NULL, 256, 15, 4088 }, -}; - -PHEAP __ProcessHeap = NULL; - -static BOOL __HeapCommit(PHEAP pheap, LPVOID start, LPVOID end); -static BOOL __HeapDecommit(PHEAP pheap, LPVOID start, LPVOID end); -static LPVOID __HeapAlloc(PHEAP pheap, ULONG flags, ULONG size, ULONG tag); -static VOID __HeapFreeRest(PHEAP pheap, PHEAP_BLOCK pfree, ULONG allocsize, - ULONG newsize); -static LPVOID __HeapReAlloc(PHEAP pheap, ULONG flags, LPVOID pold, DWORD size); -static BOOL __HeapFree(PHEAP pheap, ULONG flags, LPVOID pmem); -static PHEAP_SUBALLOC __HeapAllocSub(PHEAP pheap, PHEAP_BUCKET pbucket); -static LPVOID __HeapAllocFragment(PHEAP pheap, ULONG flags, ULONG size); -static LPVOID __HeapReAllocFragment(PHEAP pheap, ULONG flags, - LPVOID pold, ULONG size); -static BOOL __HeapFreeFragment(PHEAP pheap, ULONG flags, LPVOID ptr); -static PHEAP __HeapPrepare(LPVOID base, ULONG minsize, ULONG maxsize, - ULONG flags); - - - -/********************************************************************* -* __HeapCommit * -* * -* commits a range of memory in the heap * -*********************************************************************/ -static BOOL __HeapCommit(PHEAP pheap, LPVOID start, LPVOID end) -{ - DPRINT("__HeapCommit( 0x%lX, 0x%lX, 0x%lX)\n", - (ULONG) pheap, (ULONG) start, (ULONG) end); - - if(end >= pheap->LastBlock) - pheap->LastBlock=end; - if (VirtualAlloc(start,end-start,MEM_COMMIT,PAGE_READWRITE)!=start) - { - return(FALSE); - } - return(TRUE); -} - -/********************************************************************* -* __HeapDecommit * -* * -* decommits a range of memory in the heap * -*********************************************************************/ -static BOOL __HeapDecommit(PHEAP pheap, LPVOID start, LPVOID end) -{ - DPRINT("__HeapDecommit( 0x%lX, 0x%lX, 0x%lX)\n", - (ULONG) pheap, (ULONG) start, (ULONG) end); -#ifdef NOT - __VirtualDump(); -#endif - if((end >= pheap->LastBlock)&&(start<= pheap->LastBlock)) - pheap->LastBlock=start; - - return(VirtualFree(start,end-start,MEM_RESERVE)); -} - -/********************************************************************* -* __HeapAlloc * -* * -* allocates a range of memory from the heap * -*********************************************************************/ -static LPVOID __HeapAlloc(PHEAP pheap, ULONG flags, ULONG size, ULONG tag) -{ - PHEAP_BLOCK pfree; - PHEAP_BLOCK palloc; - PHEAP_BLOCK pnext; - LPVOID commitstart; - LPVOID commitend; - ULONG freesize; - ULONG allocsize; - - DPRINT("__HeapAlloc(pheap %x, flags %x, size %d, tag %x)\n", - pheap,flags,size,tag); - - if (size <= HEAP_ADMIN_SIZE) - { - size = size + HEAP_ADMIN_SIZE; - } - - pfree=&(pheap->Start); - allocsize=SIZE_ROUND(size); - freesize=HEAP_SIZE(pfree); - /* look for a free region of memory: simple First Fit */ - while( HEAP_ISALLOC(pfree) || ( freesize=pheap->End) - return __ErrorReturnNull(ERROR_OUTOFMEMORY); - freesize=HEAP_SIZE(pfree); - } - palloc=pfree; - - if(freesize>allocsize) - { - /* commit necessary memory */ - commitstart=(LPVOID) ROUNDDOWN((ULONG) palloc+HEAP_ADMIN_SIZE,PAGESIZE); - commitend =(LPVOID) ROUNDUP ((ULONG) palloc+ - allocsize+2*HEAP_ADMIN_SIZE, PAGESIZE); - if(commitstartSize =(freesize-allocsize-HEAP_ADMIN_SIZE) | HEAP_FREE_TAG; - pfree->PrevSize=(LPVOID)pfree-(LPVOID)palloc; - - pnext=HEAP_NEXT(pfree); - if((LPVOID) pnext < pheap->End ) - pnext->PrevSize=freesize-allocsize; - } - else - { - /* commit necessary memory */ - commitstart=(LPVOID) ROUNDDOWN((ULONG) palloc+HEAP_ADMIN_SIZE, PAGESIZE); - commitend =(LPVOID) ROUNDUP((ULONG) palloc+HEAP_ADMIN_SIZE +allocsize, - PAGESIZE); - if(commitstartSize= size | tag; - if((flags | pheap->Flags)& HEAP_ZERO_MEMORY) - FillMemory((LPVOID)palloc+HEAP_ADMIN_SIZE, allocsize, 0); - return (LPVOID)palloc+HEAP_ADMIN_SIZE; -} - -/********************************************************************* -* __HeapFreeRest * -* * -* used by realloc to free a part of the heap * -*********************************************************************/ -static VOID __HeapFreeRest(PHEAP pheap, PHEAP_BLOCK pfree, - ULONG allocsize, ULONG newsize) -{ - PHEAP_BLOCK pnext; - - if(allocsize==newsize) - { - pfree->PrevSize=allocsize+HEAP_ADMIN_SIZE; - return; - } - - pfree->Size = (allocsize-newsize-HEAP_ADMIN_SIZE) | HEAP_FREE_TAG; - pfree->PrevSize = newsize+HEAP_ADMIN_SIZE; - - pnext=HEAP_NEXT(pfree); - /* if there is a free region of memory after us, join it */ - if(((LPVOID) pnext< pheap->End)&& HEAP_ISFREE(pnext)) - { - pfree->Size = (HEAP_SIZE(pfree)+HEAP_SIZE(pnext) + HEAP_ADMIN_SIZE) | - HEAP_FREE_TAG; - - pnext->Size=0; - pnext->PrevSize=0; - } - - pnext=HEAP_NEXT(pfree); - if((LPVOID) pnext< pheap->End) - pnext->PrevSize=(LPVOID)pnext-(LPVOID)pfree; -} - -/********************************************************************* -* __HeapReAlloc * -* * -* reallocates a range of memory from the heap * -*********************************************************************/ - -static LPVOID __HeapReAlloc(PHEAP pheap, ULONG flags, LPVOID pold, DWORD size) -{ - PHEAP_BLOCK prealloc=(PHEAP_BLOCK)((LPVOID)pold-HEAP_ADMIN_SIZE); - PHEAP_BLOCK pnext; - LPVOID pmem; - LPVOID commitstart; - LPVOID commitend; - ULONG allocsize; - ULONG newsize; - ULONG oldsize; - - /* check that this is a valid allocated block */ - if(!HEAP_ISALLOC(prealloc)) - return __ErrorReturnNull(ERROR_INVALID_PARAMETER); - - allocsize = HEAP_RSIZE(prealloc); - newsize = SIZE_ROUND(size); - /* - * cases: size=0 free memory - * [ sizeprevious size try to merge - * else realloc - */ - if(size==0) - { - DPRINT("__HeapReAlloc: freeing memory\n"); - __HeapFree(pheap, flags, pold); - return NULL; - } -#ifdef NOT - else if(size < HEAP_FRAGMENT_THRESHOLD) - { - /* alloc a new fragment */ - pmem=__HeapAllocFragment(pheap, flags, size); - if(pmem) - CopyMemory(pmem, pold, size); - return pmem; - } -#endif - else if(newsize < allocsize ) - { - DPRINT("__HeapReAlloc: shrinking memory\n"); - /* free remaining region of memory */ - prealloc->Size=size | HEAP_NORMAL_TAG; - pnext=HEAP_NEXT(prealloc); - __HeapFreeRest(pheap, pnext, allocsize, newsize); - - /* decommit unnecessary memory */ - commitstart=(LPVOID) ROUNDUP((ULONG) pnext+HEAP_ADMIN_SIZE ,PAGESIZE); - commitend =(LPVOID) ROUNDDOWN((ULONG) pnext+HEAP_ADMIN_SIZE+ - HEAP_SIZE(pnext), PAGESIZE); - if(commitstartSize= size | HEAP_NORMAL_TAG; - return pold; - } - else if(newsize > allocsize) - { - /* try to merge */ - pnext=HEAP_NEXT(prealloc); - - if(((LPVOID) pnext< pheap->End)&& HEAP_ISFREE(pnext) && - (HEAP_SIZE(pnext) + HEAP_ADMIN_SIZE >=newsize-allocsize)) - { - DPRINT("__HeapReAlloc: joining memory\n"); - oldsize=HEAP_SIZE(prealloc); - prealloc->Size=size | HEAP_NORMAL_TAG; - - /* commit new memory if necessary */ - commitstart=(LPVOID) ROUNDDOWN((ULONG) pnext+HEAP_ADMIN_SIZE, - PAGESIZE); - commitend =(LPVOID) ROUNDUP((ULONG) pnext+newsize-allocsize+ - HEAP_ADMIN_SIZE, PAGESIZE); - if(commitstartFlags)&HEAP_ZERO_MEMORY) - memset(pold+oldsize, 0, size-oldsize); - return pold; - } - else - { - if((flags&HEAP_REALLOC_IN_PLACE_ONLY)==0) - { - DPRINT("__HeapReAlloc: allocating new memory\n"); - /* alloc a new piece of memory */ - oldsize=HEAP_SIZE(prealloc); - pmem=__HeapAlloc(pheap, flags, size, HEAP_NORMAL_TAG); - if(pmem) - CopyMemory(pmem, pold, oldsize); - if((flags|pheap->Flags)&HEAP_ZERO_MEMORY) - memset(pmem + oldsize, 0, size-oldsize); - __HeapFree(pheap, flags, pold); - return pmem; - } - else - return __ErrorReturnNull(ERROR_OUTOFMEMORY); - } - } - return NULL; -} - -/********************************************************************* -* __HeapFree * -* * -* frees a range of memory from the heap * -*********************************************************************/ - -static BOOL __HeapFree(PHEAP pheap, ULONG flags, LPVOID ptr) -{ - PHEAP_BLOCK pfree=(PHEAP_BLOCK)((LPVOID)ptr-HEAP_ADMIN_SIZE); - PHEAP_BLOCK pprev; - PHEAP_BLOCK pnext; - LPVOID decommitstart; - LPVOID decommitend; - - /* check that this is a valid allocated block */ - if(!HEAP_ISALLOC(pfree)) - return FALSE; - - pfree->Size = HEAP_RSIZE(pfree) | HEAP_FREE_TAG; - - /* if there is a free region of memory before us, join it */ - pprev=HEAP_PREV(pfree); - pnext=HEAP_NEXT(pfree); - if((pprev!=pfree) && HEAP_ISFREE(pprev)) - { - pprev->Size = (HEAP_SIZE(pprev)+HEAP_SIZE(pfree) + HEAP_ADMIN_SIZE) | - HEAP_FREE_TAG; - if((LPVOID) pnextEnd) - pnext->PrevSize=(LPVOID)pnext-(LPVOID)pprev; - - pfree->Size=0; - pfree->PrevSize=0; - pfree=pprev; - } - /* if there is a free region of memory after us, join it */ - if(((LPVOID) pnext< pheap->End)&& HEAP_ISFREE(pnext)) - { - pfree->Size = (HEAP_SIZE(pfree)+HEAP_SIZE(pnext) + HEAP_ADMIN_SIZE) | - HEAP_FREE_TAG; - - pnext->Size=0; - pnext->PrevSize=0; - - pnext=HEAP_NEXT(pfree); - if((LPVOID) pnext< pheap->End) - pnext->PrevSize=(LPVOID)pnext-(LPVOID)pfree; - } - - /* decommit unnecessary memory */ - decommitstart=(LPVOID) ROUNDUP((ULONG) pfree+HEAP_ADMIN_SIZE ,PAGESIZE); - decommitend =(LPVOID) ROUNDDOWN((ULONG) pfree+HEAP_ADMIN_SIZE+ - HEAP_SIZE(pfree), PAGESIZE); - if(decommitstartTotalSize, - HEAP_SUB_TAG); - if(!psub) - return __ErrorReturnNull(ERROR_OUTOFMEMORY); - - /* initialize suballoc */ - palloc=(PHEAP_FRAGMENT) ((LPVOID)psub + sizeof(HEAP_SUBALLOC)); - psub->FirstFree=palloc; - psub->NumberFree=pbucket->Number; - psub->Bitmap=0; - psub->Next=pbucket->FirstFree; - psub->Prev=NULL; - psub->Bucket=pbucket; - pbucket->FirstFree=psub; - - /* initialize free fragments */ - add=pbucket->Size+HEAP_FRAG_ADMIN_SIZE; - pprev=NULL; - for(i=0;iNumber;i++) - { - pnext=(PHEAP_FRAGMENT)((LPVOID)palloc+add); - palloc->Magic=HEAP_FRAG_MAGIC; - palloc->Number=i; - palloc->Size=pbucket->Size; - palloc->Sub=psub; - palloc->FreeNext=pnext; - palloc->FreePrev=pprev; - pprev=palloc; - palloc=pnext; - } - pprev->FreeNext=NULL; - return psub; -} - -/********************************************************************* -* __HeapAllocFragment * -* * -* allocates a small fragment of memory from the heap * -*********************************************************************/ -static LPVOID __HeapAllocFragment(PHEAP pheap, ULONG flags, ULONG size ) -{ - PHEAP_BUCKET pbucket; - PHEAP_SUBALLOC psub; - PHEAP_FRAGMENT palloc; - INT nalloc; - - DPRINT("__HeapAllocFragment(pheap %x, flags %d, size %d)\n", - pheap,flags,size); - - size = size + HEAP_FRAG_ADMIN_SIZE; - - /* get bucket size */ - pbucket=pheap->Bucket; - while(size>pbucket->Size) - { - DPRINT("pbucket->Size %d\n",pbucket->Size); - pbucket++; - } - /* get suballoc */ - psub = pbucket->FirstFree; - if(!psub) - psub = __HeapAllocSub(pheap, pbucket); - if(!psub) - return NULL; - - /* do our bookkeeping */ - palloc = psub->FirstFree; - psub->FirstFree = palloc->FreeNext; - nalloc = palloc->Number; - psub->NumberFree--; - psub->Bitmap|=(1<NumberFree) - pbucket->FirstFree=psub->Next; - - /* initialize allocated block */ - palloc->Magic=HEAP_FRAG_MAGIC; - palloc->Size=size; - - if((flags|pheap->Flags)&HEAP_ZERO_MEMORY) - memset((LPVOID)palloc+HEAP_FRAG_ADMIN_SIZE, 0, pbucket->Size); - return (LPVOID) palloc+HEAP_FRAG_ADMIN_SIZE; -} - -/********************************************************************* -* __HeapReAllocFragment * -* * -* reallocates a small fragment of memory * -*********************************************************************/ -static LPVOID __HeapReAllocFragment(PHEAP pheap, ULONG flags, - LPVOID pold, ULONG size ) -{ - PHEAP_BUCKET pbucket; - PHEAP_SUBALLOC psub; - PHEAP_FRAGMENT pfrag=(PHEAP_FRAGMENT) - ((LPVOID)pold-HEAP_FRAG_ADMIN_SIZE); - LPVOID pmem; - - /* sanity checks */ - if(pfrag->Magic!=HEAP_FRAG_MAGIC) - return __ErrorReturnNull(ERROR_INVALID_PARAMETER); - - /* get bucket size */ - psub=pfrag->Sub; - pbucket=psub->Bucket; - if(size<=pbucket->Size) - { - pfrag->Size=size; - return pold; - } - else - { - if((flags&HEAP_REALLOC_IN_PLACE_ONLY)==0) - { - /* alloc a new piece of memory */ - if(size>HEAP_FRAGMENT_THRESHOLD) - pmem=__HeapAlloc(pheap, flags, size, HEAP_NORMAL_TAG); - else - pmem=__HeapAllocFragment(pheap, flags, size); - - if(pmem) - CopyMemory(pmem, pold, size); - if((flags|pheap->Flags)&HEAP_ZERO_MEMORY) - memset(pmem+pfrag->Size, 0, size-pfrag->Size); - - __HeapFreeFragment(pheap, flags, pold); - return pmem; - } - } - return NULL; -} - -/********************************************************************* -* __HeapFreeFragment * -* * -* frees a small fragment of memory * -*********************************************************************/ -static BOOL __HeapFreeFragment(PHEAP pheap, ULONG flags, LPVOID pfree ) -{ - PHEAP_BUCKET pbucket; - PHEAP_SUBALLOC psub; - PHEAP_FRAGMENT pfrag=(PHEAP_FRAGMENT) - ((DWORD)pfree - HEAP_FRAG_ADMIN_SIZE); - INT nalloc; - - /* sanity checks */ - if(pfrag->Magic!=HEAP_FRAG_MAGIC) - return __ErrorReturnFalse(ERROR_INVALID_PARAMETER); - - /* get bucket size */ - psub=pfrag->Sub; - pbucket=psub->Bucket; - - nalloc=pfrag->Number; - if((psub->Bitmap&(1<NumberFree++; - if(psub->NumberFree==pbucket->Number) - { - /* free suballoc */ - if(psub==pbucket->FirstFree) - pbucket->FirstFree=psub->Next; - if(psub->Prev) - psub->Prev->Next=psub->Next; - if(psub->Next) - psub->Next->Prev=psub->Prev; - if(!__HeapFree(pheap, flags, psub)) - return FALSE; - } - else - { - /* free fragment */ - psub->Bitmap&= ~(1<FirstFree) - { - pfrag->FreeNext = psub->FirstFree; - pfrag->FreePrev = NULL; - psub->FirstFree->FreePrev = pfrag; - psub->FirstFree = pfrag; - } - else - { - psub->FirstFree=pfrag; - pfrag->FreePrev=NULL; - pfrag->FreeNext=NULL; - } - } - - return TRUE; -} - -/********************************************************************* -* __HeapPrepare * -* * -* Fills in all the data structures of a heap * -*********************************************************************/ -PHEAP __HeapPrepare(LPVOID base, ULONG minsize, ULONG maxsize, ULONG flags) -{ - PHEAP pheap=(PHEAP) base; - - DPRINT("__HeapPrepare(base %x, minsize %d, maxsize %d, flags %x)\n", - base,minsize,maxsize,flags); - - pheap->Magic=MAGIC_HEAP; - pheap->End= ((LPVOID)pheap)+minsize; - pheap->Flags=flags; - pheap->LastBlock=(LPVOID)pheap + PAGESIZE; - CopyMemory(pheap->Bucket, - __HeapDefaultBuckets, - sizeof(__HeapDefaultBuckets)); - if (__ProcessHeap) - { - pheap->NextHeap=__ProcessHeap->NextHeap; - __ProcessHeap->NextHeap=pheap; - } - else - { - pheap->NextHeap=0; - __ProcessHeap=pheap; - } - InitializeCriticalSection(&(pheap->Synchronize)); - pheap->Start.Size= (minsize-sizeof(HEAP))|HEAP_FREE_TAG; - pheap->Start.PrevSize =0; - - return pheap; -} - -/********************************************************************* -* __HeapInit * -* * -* Called by __VirtualInit to initialize the default process heap * -*********************************************************************/ - -VOID WINAPI __HeapInit(LPVOID base, ULONG minsize, ULONG maxsize) -{ - PHEAP NewHeap; - NewHeap = VirtualAlloc(base, maxsize, MEM_RESERVE, PAGE_READWRITE); - VirtualAlloc(NewHeap, PAGESIZE, MEM_COMMIT, PAGE_READWRITE); - __HeapPrepare(NewHeap, minsize, maxsize, 0); - __ProcessHeap = NewHeap; -} - +#define NDEBUG +#include /********************************************************************* * HeapCreate -- KERNEL32 * *********************************************************************/ HANDLE STDCALL HeapCreate(DWORD flags, DWORD minsize, DWORD maxsize) { - PHEAP pheap; DPRINT("HeapCreate( 0x%lX, 0x%lX, 0x%lX )\n", flags, minsize, maxsize); - - pheap = VirtualAlloc(NULL, minsize, MEM_TOP_DOWN, PAGE_READWRITE); - VirtualAlloc(pheap, PAGESIZE, MEM_COMMIT, PAGE_READWRITE); - return (HANDLE) __HeapPrepare(pheap, minsize, maxsize, flags); + return(RtlCreateHeap(flags, NULL, maxsize, minsize, NULL, NULL)); } /********************************************************************* @@ -671,17 +46,7 @@ HANDLE STDCALL HeapCreate(DWORD flags, DWORD minsize, DWORD maxsize) *********************************************************************/ BOOL WINAPI HeapDestroy(HANDLE hheap) { - PHEAP pheap=(PHEAP) hheap; - - DPRINT("HeapDestroy( 0x%lX )\n", (ULONG) hheap ); - - if(pheap->Magic!=MAGIC_HEAP) - return __ErrorReturnFalse(ERROR_INVALID_PARAMETER); - - DeleteCriticalSection(&(pheap->Synchronize)); - VirtualFree(pheap,0,MEM_RELEASE); - - return TRUE; + return(RtlDestroyHeap(hheap)); } /********************************************************************* @@ -689,32 +54,7 @@ BOOL WINAPI HeapDestroy(HANDLE hheap) *********************************************************************/ LPVOID STDCALL HeapAlloc(HANDLE hheap, DWORD flags, DWORD size) { - - PHEAP pheap=hheap; - LPVOID retval; - - DPRINT("HeapAlloc(hheap 0x%lX, flags 0x%lX, size 0x%lX )\n", - (ULONG) hheap, flags, (ULONG) size ); -#ifdef HEAP_VALIDATE - HeapValidate(hheap, 0, 0); -#endif - if(( flags | pheap->Flags) & HEAP_NO_SERIALIZE ) - EnterCriticalSection(&(pheap->Synchronize)); - - if(size>HEAP_FRAGMENT_THRESHOLD) - retval=__HeapAlloc(pheap, flags, size, HEAP_NORMAL_TAG); - else - retval=__HeapAllocFragment(pheap, flags, size); - - if( (flags | pheap->Flags) & HEAP_NO_SERIALIZE ) - LeaveCriticalSection(&(pheap->Synchronize)); - - DPRINT("HeapAlloc returns 0x%lX\n", (ULONG) retval); - - HeapValidate(hheap, 0, 0); - return retval; - - + return(RtlAllocateHeap(hheap, flags, size)); } /********************************************************************* @@ -722,32 +62,7 @@ LPVOID STDCALL HeapAlloc(HANDLE hheap, DWORD flags, DWORD size) *********************************************************************/ LPVOID STDCALL HeapReAlloc(HANDLE hheap, DWORD flags, LPVOID ptr, DWORD size) { - - PHEAP pheap=hheap; - PHEAP_BLOCK pfree=((PHEAP_BLOCK)ptr-1); - LPVOID retval; - - DPRINT("HeapReAlloc( 0x%lX, 0x%lX, 0x%lX, 0x%lX )\n", - (ULONG) hheap, flags, (ULONG) ptr, size ); -#ifdef HEAP_VALIDATE - HeapValidate(hheap, 0, 0); -#endif - if(( flags | pheap->Flags) & HEAP_NO_SERIALIZE ) - EnterCriticalSection(&(pheap->Synchronize)); - - if(HEAP_ISNORMAL(pfree)) - retval=__HeapReAlloc(pheap, flags, ptr, size); - else if(HEAP_ISFRAG(pfree)) - retval=__HeapReAllocFragment(pheap, flags, ptr, size); - else - retval=__ErrorReturnNull(ERROR_INVALID_PARAMETER); - - if( (flags| pheap->Flags) & HEAP_NO_SERIALIZE ) - LeaveCriticalSection(&(pheap->Synchronize)); - - return retval; - - + return(RtlReAllocHeap(hheap, flags, ptr, size)); } /********************************************************************* @@ -755,37 +70,7 @@ LPVOID STDCALL HeapReAlloc(HANDLE hheap, DWORD flags, LPVOID ptr, DWORD size) *********************************************************************/ WINBOOL STDCALL HeapFree(HANDLE hheap, DWORD flags, LPVOID ptr) { - - PHEAP pheap=hheap; - PHEAP_BLOCK pfree=(PHEAP_BLOCK)((DWORD)ptr-HEAP_ADMIN_SIZE); - BOOL retval; - - DPRINT("HeapFree( 0x%lX, 0x%lX, 0x%lX )\n", - (ULONG) hheap, flags, (ULONG) ptr ); -#ifdef HEAP_VALIDATE - HeapValidate(hheap, 0, 0); -#endif - if(( flags | pheap->Flags) & HEAP_NO_SERIALIZE ) - EnterCriticalSection(&(pheap->Synchronize)); - - if(HEAP_ISNORMAL(pfree)) - { - retval=__HeapFree(pheap, flags, ptr); - } - else if(HEAP_ISFRAG(pfree)) - { - retval=__HeapFreeFragment(pheap, flags, ptr); - } - else - { - retval=__ErrorReturnFalse(ERROR_INVALID_PARAMETER); - } - - if( (flags| pheap->Flags) & HEAP_NO_SERIALIZE ) - LeaveCriticalSection(&(pheap->Synchronize)); - - return retval; - + return(RtlFreeHeap(hheap, flags, ptr)); } /********************************************************************* @@ -794,7 +79,7 @@ WINBOOL STDCALL HeapFree(HANDLE hheap, DWORD flags, LPVOID ptr) HANDLE WINAPI GetProcessHeap(VOID) { DPRINT("GetProcessHeap()\n"); - return (HANDLE) __ProcessHeap; + return(RtlGetProcessHeap()); } /******************************************************************** @@ -805,57 +90,22 @@ HANDLE WINAPI GetProcessHeap(VOID) ********************************************************************/ DWORD WINAPI GetProcessHeaps(DWORD maxheaps, PHANDLE phandles ) { - DWORD retval; - PHEAP pheap; - - DPRINT("GetProcessHeaps( %u, 0x%lX )\n", maxheaps, (ULONG) phandles ); - - pheap= __ProcessHeap; - retval=0; - while((pheap)&&(maxheaps)) - { - *phandles=pheap; - phandles++; - maxheaps--; - retval++; - pheap=pheap->NextHeap; - } - while(pheap) - { - retval++; - pheap=pheap->NextHeap; - } - - - return retval; } /********************************************************************* * HeapLock -- KERNEL32 * *********************************************************************/ - BOOL WINAPI HeapLock(HANDLE hheap) { - PHEAP pheap=hheap; - - DPRINT("HeapLock( 0x%lX )\n", (ULONG) hheap ); - - EnterCriticalSection(&(pheap->Synchronize)); - return TRUE; + return(RtlLockHeap(hheap)); } /********************************************************************* * HeapUnlock -- KERNEL32 * *********************************************************************/ - BOOL WINAPI HeapUnlock(HANDLE hheap) { - PHEAP pheap=hheap; - - DPRINT("HeapUnlock( 0x%lX )\n", (ULONG) hheap ); - - LeaveCriticalSection(&(pheap->Synchronize)); - return TRUE; + return(RtlUnlockHeap(hheap)); } /********************************************************************* @@ -864,34 +114,9 @@ BOOL WINAPI HeapUnlock(HANDLE hheap) * NT uses this function to compact moveable blocks and other things * * Here it does not compact, but it finds the largest free region * *********************************************************************/ - UINT HeapCompact(HANDLE hheap, DWORD flags) { - PHEAP pheap=hheap; - PHEAP_BLOCK pfree; - ULONG freesize; - ULONG largestfree; - - if(( flags | pheap->Flags) & HEAP_NO_SERIALIZE ) - EnterCriticalSection(&(pheap->Synchronize)); - - pfree=&(pheap->Start); - /* look for the largest free region of memory */ - largestfree=0; - do - { - freesize=HEAP_SIZE(pfree); - if(HEAP_ISFREE(pfree) && freesize>largestfree) - largestfree=freesize; - - pfree=HEAP_NEXT(pfree); - } - while( (LPVOID)pfree < pheap->End ); - - if( (flags| pheap->Flags) & HEAP_NO_SERIALIZE ) - LeaveCriticalSection(&(pheap->Synchronize)); - - return largestfree; + return(RtlCompactHeap(hheap, flags)); } /********************************************************************* @@ -899,33 +124,7 @@ UINT HeapCompact(HANDLE hheap, DWORD flags) *********************************************************************/ DWORD WINAPI HeapSize(HANDLE hheap, DWORD flags, LPCVOID pmem) { - PHEAP pheap=(PHEAP) hheap; - PHEAP_BLOCK palloc=((PHEAP_BLOCK)pmem-1); - DWORD retval=0; - - DPRINT("HeapSize( 0x%lX, 0x%lX, 0x%lX )\n", - (ULONG) hheap, flags, (ULONG) pmem ); - - if(pheap->Magic!=MAGIC_HEAP) - { SetLastError(ERROR_INVALID_PARAMETER); return 0; } - - if(( flags | pheap->Flags) & HEAP_NO_SERIALIZE ) - EnterCriticalSection(&(pheap->Synchronize)); - - if((pmem> (LPVOID)pheap)&&(pmem < pheap->End)) - { - if(HEAP_ISALLOC(palloc)) - retval=HEAP_SIZE(palloc); /* normal allocation */ - else if(HEAP_ISFRAG(palloc)) - retval=HEAP_FRAG_SIZE(palloc); /* fragment */ - else - { SetLastError(ERROR_INVALID_PARAMETER); retval = -1; } - } - - if( (flags| pheap->Flags) & HEAP_NO_SERIALIZE ) - LeaveCriticalSection(&(pheap->Synchronize)); - - return retval; + return(RtlSizeHeap(hheap, flags, pmem)); } /********************************************************************* @@ -935,120 +134,6 @@ DWORD WINAPI HeapSize(HANDLE hheap, DWORD flags, LPCVOID pmem) *********************************************************************/ BOOL WINAPI HeapValidate(HANDLE hheap, DWORD flags, LPCVOID pmem) { - PHEAP pheap=(PHEAP)hheap; - PHEAP_BLOCK pcheck; - PHEAP_BLOCK pprev; - PHEAP_BLOCK pnext; - PHEAP_SUBALLOC psub; - PHEAP_FRAGMENT pfrag; - PHEAP_FRAGMENT pnextfrag; - PHEAP_FRAGMENT pprevfrag; - PHEAP_BUCKET pbucket; - INT i; - INT number; - INT add; - - if(( flags | pheap->Flags) & HEAP_NO_SERIALIZE ) - EnterCriticalSection(&(pheap->Synchronize)); - - if(pmem==NULL) - { - pcheck=&(pheap->Start); - pprev=NULL; - /* verify all blocks */ - do - { - pnext=HEAP_NEXT(pcheck); - if((pprev)&&(HEAP_PREV(pcheck)!=pprev)) - { - DPRINT("HeapValidate: linked list invalid, region 0x%lX," - " previous region 0x%lX, list says 0x%lX\n", - (ULONG)pcheck, (ULONG)pprev, (ULONG) HEAP_PREV(pcheck)); - return FALSE; - } - if(HEAP_ISSUB(pcheck)) - { - - /* check fragments */ - psub=(PHEAP_SUBALLOC) ((PHEAP_BLOCK)pcheck+1); - pbucket=psub->Bucket; - pfrag=(PHEAP_FRAGMENT) ((LPVOID)psub + sizeof(HEAP_SUBALLOC)); - - if(psub->NumberFree>pbucket->Number) - return FALSE; - - add=pbucket->Size+HEAP_FRAG_ADMIN_SIZE; - pprevfrag=NULL; - number=0; - for(i=0;iNumber;i++) - { - pnextfrag=(PHEAP_FRAGMENT)((LPVOID)pfrag+add); - if(pfrag->Magic!=HEAP_FRAG_MAGIC) - { - DPRINT("HeapValidate: fragment %d magic invalid, region 0x%lX," - " previous region 0x%lX\n", i, (ULONG)pcheck, (ULONG)pprev); - return FALSE; - } - if(pfrag->Number!=i) - { - DPRINT("HeapValidate: fragment %d number invalid, region 0x%lX," - " previous region 0x%lX\n", i, (ULONG)pcheck, (ULONG)pprev); - return FALSE; - } - if((psub->Bitmap&(1<Sub!=psub) - { - DPRINT("HeapValidate: fragment %d suballoc invalid, region 0x%lX," - " previous region 0x%lX\n", i, (ULONG)pcheck, (ULONG)pprev); - return FALSE; - } - pprevfrag=pfrag; - pfrag=pnextfrag; - } - if(number!=psub->NumberFree) - { - DPRINT("HeapValidate: invalid number of free fragments, region 0x%lX," - " previous region 0x%lX\n", (ULONG)pcheck, (ULONG)pprev); - return FALSE; - } - DPRINT("HeapValidate: [0x%08lX-0x%08lX] suballocated," - " bucket size=%d, bitmap=0x%08lX\n", - (ULONG) pcheck, (ULONG) pnext, pbucket->Size, psub->Bitmap); - } - else if(HEAP_ISFREE(pcheck)) - { - if(HEAP_RSIZE(pcheck)!=HEAP_SIZE(pcheck)) - { - DPRINT("HeapValidate: invalid size of free region 0x%lX," - " previous region 0x%lX\n", - (ULONG) pcheck, (ULONG) pprev); - return FALSE; - } - DPRINT("HeapValidate: [0x%08lX-0x%08lX] free\n", - (ULONG) pcheck, (ULONG) pnext ); - } - else if(HEAP_ISNORMAL(pcheck)) - { - DPRINT("HeapValidate: [0x%08lX-0x%08lX] allocated\n", - (ULONG) pcheck, (ULONG) pnext ); - } - else - { - DPRINT("HeapValidate: invalid tag %x, region 0x%lX," - " previous region 0x%lX\n", pcheck->Size>>28, - (ULONG)pcheck, (ULONG)pprev); - return FALSE; - } - pprev=pcheck; - pcheck=HEAP_NEXT(pcheck); - } - while( (LPVOID)pcheck < pheap->End ); - } - - if( (flags| pheap->Flags) & HEAP_NO_SERIALIZE ) - LeaveCriticalSection(&(pheap->Synchronize)); - - return TRUE; + return(RtlValidateHeap(hheap, flags, pmem)); } diff --git a/reactos/lib/kernel32/misc/dllmain.c b/reactos/lib/kernel32/misc/dllmain.c index b4dafb6ad1f..abd698ea0a4 100644 --- a/reactos/lib/kernel32/misc/dllmain.c +++ b/reactos/lib/kernel32/misc/dllmain.c @@ -13,22 +13,19 @@ #include #include -WINBOOL -STDCALL -DllMain ( - HANDLE hInst, - ULONG ul_reason_for_call, - LPVOID lpReserved ); +WINBOOL STDCALL DllMain (HANDLE hInst, + ULONG ul_reason_for_call, + LPVOID lpReserved); NT_TEB *Teb; - - - - +BOOL WINAPI DllMainCRTStartup(HANDLE hDll, DWORD dwReason, LPVOID lpReserved) +{ + return(TRUE); +} WINBOOL STDCALL DllMain (HANDLE hInst, ULONG ul_reason_for_call, diff --git a/reactos/lib/ntdll/Makefile_rex b/reactos/lib/ntdll/Makefile_rex new file mode 100644 index 00000000000..b0245682f64 --- /dev/null +++ b/reactos/lib/ntdll/Makefile_rex @@ -0,0 +1,45 @@ +ifneq ($(HOST),mingw32-windows) + ifneq ($(HOST),mingw32-linux) + DLLTARGET=ntdll.a + DLLMAIN= + else + DLLTARGET=ntdll.dll + DLLMAIN=main/dllmain.o + endif +else + DLLTARGET=ntdll.dll + DLLMAIN=main/dllmain.o +endif + +all: $(DLLTARGET) + +OBJECTS = napi.o ldr/startup.o rtl/largeint.o rtl/namespc.o rtl/unicode.o \ + stdio/vsprintf.o string/ctype.o string/memcpy.o string/memset.o \ + string/strcat.o string/strcmp.o string/strcpy.o string/stricmp.o \ + string/strlen.o string/strncmp.o string/strncpy.o string/strnlen.o \ + string/strrchr.o string/wstring.o stubs/stubs.o rtl/heap.o \ + rtl/critical.o rtl/mem.o + +ntdll.a: $(OBJECTS) + $(AR) csr ntdll.a $(OBJECTS) + +ntdll.dll: $(DLLMAIN) $(OBJECTS) def/ntdll.def + $(LD) -r $(DLLMAIN) $(OBJECTS) -o ntdll.o + $(DLLTOOL) --dllname ntdll.dll --def def/ntdll.def \ + --output-lib ntdll.a + $(CC) -specs=ntdll_specs -mdll -o junk.tmp \ + -Wl,--base-file,base.tmp ntdll.o + - $(RM) junk.tmp + $(DLLTOOL) --dllname ntdll.dll --base-file base.tmp \ + --output-exp temp.exp --def def/ntdll.def + - $(RM) base.tmp + $(CC) -specs=ntdll_specs -mdll -o ntdll.dll ntdll.o \ + -Wl,--entry=_LdrStartup \ + -Wl,--image-base,0x80000000 \ + -Wl,--file-alignment,0x1000 \ + -Wl,--section-alignment,0x1000 \ + -Wl,temp.exp + - $(RM) temp.exp + $(NM) --numeric-sort ntdll.dll > ntdll.sym + +include ../../rules.mak diff --git a/reactos/lib/ntdll/def/ntdll.def b/reactos/lib/ntdll/def/ntdll.def index e5b03838a05..8056ca6b865 100644 --- a/reactos/lib/ntdll/def/ntdll.def +++ b/reactos/lib/ntdll/def/ntdll.def @@ -420,6 +420,17 @@ ZwReplyWaitSendChannel@12 ZwSendWaitReplyChannel@16 ZwSetContextChannel@4 ZwYieldExecution@0 +RtlAllocateHeap@12 +RtlCreateHeap@24 +RtlCompactHeap +RtlDestroyHeap@4 +RtlFreeHeap@12 +RtlGetProcessHeap@0 +RtlLockHeap@4 +RtlReAllocHeap@16 +RtlSizeHeap@12 +RtlUnlockHeap@4 +RtlValidateHeap@12 RtlInitAnsiString RtlInitUnicodeString RtlLargeIntegerDivide @@ -428,6 +439,7 @@ RtlEnlargedIntegerMultiply RtlEnlargedUnsignedMultiply RtlExtendedIntegerMultiply isalpha +iswlower memcpy memset strcat @@ -438,6 +450,7 @@ strncpy strlen strrchr toupper +towupper wcscpy wcschr wcscat diff --git a/reactos/lib/ntdll/ldr/startup.c b/reactos/lib/ntdll/ldr/startup.c index 8bf94e8e062..57e693a5565 100644 --- a/reactos/lib/ntdll/ldr/startup.c +++ b/reactos/lib/ntdll/ldr/startup.c @@ -17,14 +17,14 @@ #include #include -#define NDEBUG +//#define NDEBUG #include -VOID WINAPI __RtlInitHeap(LPVOID base, ULONG minsize, ULONG maxsize); +PVOID WINAPI __RtlInitHeap(LPVOID base, ULONG minsize, ULONG maxsize); /* MACROS ********************************************************************/ -#define RVA(m, b) ((ULONG)b + m->BaseAddress) +#define RVA(m, b) ((ULONG)b + m) /* TYPEDEFS ******************************************************************/ @@ -42,6 +42,8 @@ typedef struct _DLL static DLL DllListHead; +#define HEAP_BASE (0xa0000000) + /* FORWARD DECLARATIONS ******************************************************/ static PEPFUNC LdrPEStartup(DWORD ImageBase, HANDLE SectionHandle); @@ -83,12 +85,126 @@ static NTSTATUS LdrMapSections(PVOID ImageBase, HANDLE SectionHandle, } static NTSTATUS LdrLoadDll(PDLL* Base, PCHAR Name) +{ + char fqname[255] = "\\??\\C:\\reactos\\system\\"; + ANSI_STRING AnsiString; + UNICODE_STRING UnicodeString; + OBJECT_ATTRIBUTES FileObjectAttributes; + char BlockBuffer[1024]; + PIMAGE_DOS_HEADER DosHeader; + NTSTATUS Status; + PIMAGE_NT_HEADERS NTHeaders; + PEPFUNC DllStartupAddr; + ULONG ImageBase, ImageSize, InitialViewSize; + HANDLE FileHandle, SectionHandle; + PDLL DllDesc; + + DPRINT("LdrLoadDll(Base %x, Name %s)\n",Base,Name); + + strcat(fqname, Name); + + DPRINT("fqname %s\n",fqname); + + RtlInitAnsiString(&AnsiString,fqname); + RtlAnsiStringToUnicodeString(&UnicodeString,&AnsiString,TRUE); + + InitializeObjectAttributes(&FileObjectAttributes, + &UnicodeString, + 0, + NULL, + NULL); + DPRINT("Opening dll\n"); + Status = ZwOpenFile(&FileHandle, FILE_ALL_ACCESS, &FileObjectAttributes, + NULL, 0, 0); + if (!NT_SUCCESS(Status)) + { + DPRINT("Dll open failed "); + return Status; + } + Status = ZwReadFile(FileHandle, 0, 0, 0, 0, BlockBuffer, 1024, 0, 0); + if (!NT_SUCCESS(Status)) + { + DPRINT("Dll header read failed "); + ZwClose(FileHandle); + return Status; + } + + DosHeader = (PIMAGE_DOS_HEADER) BlockBuffer; + if (DosHeader->e_magic != IMAGE_DOS_MAGIC || + DosHeader->e_lfanew == 0L || + *(PULONG)((PUCHAR)BlockBuffer + DosHeader->e_lfanew) != IMAGE_PE_MAGIC) + { + DPRINT("NTDLL format invalid\n"); + ZwClose(FileHandle); + + return STATUS_UNSUCCESSFUL; + } + NTHeaders = (PIMAGE_NT_HEADERS)(BlockBuffer + DosHeader->e_lfanew); + ImageBase = NTHeaders->OptionalHeader.ImageBase; + ImageSize = NTHeaders->OptionalHeader.SizeOfImage; + + DPRINT("ImageBase %x\n",ImageBase); + DllStartupAddr = ImageBase + NTHeaders->OptionalHeader.AddressOfEntryPoint; + + /* Create a section for NTDLL */ + Status = ZwCreateSection(&SectionHandle, + SECTION_ALL_ACCESS, + NULL, + NULL, + PAGE_READWRITE, + MEM_COMMIT, + FileHandle); + if (!NT_SUCCESS(Status)) + { + DPRINT("NTDLL create section failed "); + ZwClose(FileHandle); + return Status; + } + + /* Map the NTDLL into the process */ + InitialViewSize = DosHeader->e_lfanew + sizeof(IMAGE_NT_HEADERS) + + sizeof(IMAGE_SECTION_HEADER) * NTHeaders->FileHeader.NumberOfSections; + Status = ZwMapViewOfSection(SectionHandle, + NtCurrentProcess(), + (PVOID *)&ImageBase, + 0, + InitialViewSize, + NULL, + &InitialViewSize, + 0, + MEM_COMMIT, + PAGE_READWRITE); + if (!NT_SUCCESS(Status)) + { + DPRINT("NTDLL map view of secion failed "); + ZwClose(FileHandle); + + return Status; + } + ZwClose(FileHandle); + + DllDesc = RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof(DLL)); + DllDesc->Headers = NTHeaders; + DllDesc->BaseAddress = ImageBase; + DllDesc->Next = DllListHead.Next; + DllDesc->Prev = &DllListHead; + DllListHead.Next->Prev = DllDesc; + DllListHead.Next = DllDesc; + + LdrPEStartup(ImageBase, SectionHandle); + + *Base = DllDesc; + + return(STATUS_SUCCESS); +} + +static NTSTATUS LdrFindDll(PDLL* Base, PCHAR Name) { PIMAGE_EXPORT_DIRECTORY ExportDir; DLL* current; PIMAGE_OPTIONAL_HEADER OptionalHeader; - DPRINT("LdrLoadDll(Name %s)\n",Name); + DPRINT("LdrFindDll(Name %s)\n",Name); current = &DllListHead; do @@ -98,8 +214,6 @@ static NTSTATUS LdrLoadDll(PDLL* Base, PCHAR Name) IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress; ExportDir = ((ULONG)ExportDir + (ULONG)current->BaseAddress); - DPRINT("ExportDir %x\n",ExportDir); - DPRINT("Scanning %x\n",ExportDir->Name); DPRINT("Scanning %s\n",ExportDir->Name + current->BaseAddress); if (strcmp(ExportDir->Name + current->BaseAddress, Name) == 0) { @@ -110,11 +224,11 @@ static NTSTATUS LdrLoadDll(PDLL* Base, PCHAR Name) current = current->Next; } while (current != &DllListHead); - return(STATUS_UNSUCCESSFUL); + DPRINT("Failed to find dll %s\n",Name); + + return(LdrLoadDll(Base, Name)); } -#define HEAP_BASE (0xa0000000) - /* LdrStartup * FUNCTION: * Handles Process Startup Activities. @@ -125,7 +239,6 @@ VOID LdrStartup(HANDLE SectionHandle, DWORD ImageBase) { PEPFUNC EntryPoint; PIMAGE_DOS_HEADER PEDosHeader; - char buffer[512]; NTSTATUS Status; PIMAGE_NT_HEADERS NTHeaders; @@ -161,12 +274,26 @@ VOID LdrStartup(HANDLE SectionHandle, DWORD ImageBase) ZwTerminateProcess(NULL,STATUS_UNSUCCESSFUL); } - DPRINT("Transferring control to image\n"); + DPRINT("Transferring control to image at %x\n",EntryPoint); Status = EntryPoint(); ZwTerminateProcess(NtCurrentProcess(),Status); } -static PVOID LdrGetExport(PDLL Module, PUCHAR SymbolName) +static PVOID LdrGetExportByOrdinal(PDLL Module, ULONG Ordinal) +{ + PIMAGE_EXPORT_DIRECTORY ExportDir; + USHORT* ExOrdinals; + + ExportDir = (Module->BaseAddress + + (Module->Headers->OptionalHeader. + DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress)); + + ExOrdinals = (USHORT*)RVA(Module->BaseAddress, + ExportDir->AddressOfNameOrdinals); + return(ExOrdinals[Ordinal - ExportDir->Base]); +} + +static PVOID LdrGetExportByName(PDLL Module, PUCHAR SymbolName) { PIMAGE_EXPORT_DIRECTORY ExportDir; PDWORD* ExFunctions; @@ -184,196 +311,200 @@ static PVOID LdrGetExport(PDLL Module, PUCHAR SymbolName) DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress)); /* Get header pointers */ - ExNames = (PDWORD*)RVA(Module, ExportDir->AddressOfNames); - ExOrdinals = (USHORT*)RVA(Module, ExportDir->AddressOfNameOrdinals); - ExFunctions = (PDWORD*)RVA(Module, ExportDir->AddressOfFunctions); + ExNames = (PDWORD*)RVA(Module->BaseAddress, ExportDir->AddressOfNames); + ExOrdinals = (USHORT*)RVA(Module->BaseAddress, + ExportDir->AddressOfNameOrdinals); + ExFunctions = (PDWORD*)RVA(Module->BaseAddress, + ExportDir->AddressOfFunctions); for (i=0; iNumberOfFunctions; i++) { - ExName = RVA(Module, ExNames[i]); + ExName = RVA(Module->BaseAddress, ExNames[i]); if (strcmp(ExName,SymbolName) == 0) { Ordinal = ExOrdinals[i]; - return(RVA(Module, ExFunctions[Ordinal])); + return(RVA(Module->BaseAddress, ExFunctions[Ordinal])); } } return(NULL); } -static PEPFUNC LdrPEStartup(DWORD ImageBase, HANDLE SectionHandle) +static NTSTATUS LdrPerformRelocations(PIMAGE_NT_HEADERS NTHeaders, + DWORD ImageBase) { - int i; - PVOID SectionBase; - NTSTATUS Status; - PEPFUNC EntryPoint; - PIMAGE_DOS_HEADER DosHeader; - PIMAGE_NT_HEADERS NTHeaders; - PIMAGE_SECTION_HEADER SectionList; - char buffer[512]; - PDLL Module; + USHORT NumberOfEntries; + PUSHORT pValue16; + ULONG RelocationRVA; + ULONG Delta32, Offset; + PULONG pValue32; + PRELOCATION_DIRECTORY RelocationDir; + PRELOCATION_ENTRY RelocationBlock; + int i; - DosHeader = (PIMAGE_DOS_HEADER) ImageBase; - NTHeaders = (PIMAGE_NT_HEADERS)(ImageBase + DosHeader->e_lfanew); - SectionList = (PIMAGE_SECTION_HEADER) (ImageBase + DosHeader->e_lfanew + - sizeof(ULONG) + sizeof(IMAGE_FILE_HEADER) + sizeof(IMAGE_OPTIONAL_HEADER)); - - /* Initialize Image sections */ - LdrMapSections(ImageBase, SectionHandle, NTHeaders); - - /* FIXME: if actual load address is different from ImageBase, then reloc */ - if (ImageBase != (DWORD) NTHeaders->OptionalHeader.ImageBase) - { - USHORT NumberOfEntries; - PUSHORT pValue16; - ULONG RelocationRVA; - ULONG Delta32, Offset; - PULONG pValue32; - PRELOCATION_DIRECTORY RelocationDir; - PRELOCATION_ENTRY RelocationBlock; - - RelocationRVA = NTHeaders->OptionalHeader.DataDirectory[ - IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress; - if (RelocationRVA) - { - RelocationDir = (PRELOCATION_DIRECTORY) - ((PCHAR)ImageBase + RelocationRVA); - while (RelocationDir->SizeOfBlock) - { - Delta32 = (unsigned long)(ImageBase - - NTHeaders->OptionalHeader.ImageBase); - RelocationBlock = (PRELOCATION_ENTRY) - (RelocationRVA + ImageBase + sizeof(RELOCATION_DIRECTORY)); - NumberOfEntries = - (RelocationDir->SizeOfBlock - sizeof(RELOCATION_DIRECTORY)) / - sizeof(RELOCATION_ENTRY); - for (i = 0; i < NumberOfEntries; i++) - { + RelocationRVA = NTHeaders->OptionalHeader.DataDirectory[ + IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress; + if (RelocationRVA) + { + RelocationDir = (PRELOCATION_DIRECTORY)((PCHAR)ImageBase + + RelocationRVA); + while (RelocationDir->SizeOfBlock) + { + Delta32 = (unsigned long)(ImageBase - + NTHeaders->OptionalHeader.ImageBase); + RelocationBlock = (PRELOCATION_ENTRY) + (RelocationRVA + ImageBase + sizeof(RELOCATION_DIRECTORY)); + NumberOfEntries = + (RelocationDir->SizeOfBlock - sizeof(RELOCATION_DIRECTORY)) / + sizeof(RELOCATION_ENTRY); + for (i = 0; i < NumberOfEntries; i++) + { Offset = (RelocationBlock[i].TypeOffset & 0xfff) + RelocationDir->VirtualAddress; switch (RelocationBlock[i].TypeOffset >> 12) { case TYPE_RELOC_ABSOLUTE: break; - - case TYPE_RELOC_HIGH: - pValue16 = (PUSHORT) (ImageBase + Offset); - *pValue16 += Delta32 >> 16; - break; - - case TYPE_RELOC_LOW: - pValue16 = (PUSHORT)(ImageBase + Offset); - *pValue16 += Delta32 & 0xffff; - break; - - case TYPE_RELOC_HIGHLOW: - pValue32 = (PULONG) (ImageBase + Offset); - *pValue32 += Delta32; - break; - + + case TYPE_RELOC_HIGH: + pValue16 = (PUSHORT) (ImageBase + Offset); + *pValue16 += Delta32 >> 16; + break; + + case TYPE_RELOC_LOW: + pValue16 = (PUSHORT)(ImageBase + Offset); + *pValue16 += Delta32 & 0xffff; + break; + + case TYPE_RELOC_HIGHLOW: + pValue32 = (PULONG) (ImageBase + Offset); + *pValue32 += Delta32; + break; + case TYPE_RELOC_HIGHADJ: - /* FIXME: do the highadjust fixup */ - DPRINT( - "TYPE_RELOC_HIGHADJ fixup not implemented, sorry\n"); - return 0; - + /* FIXME: do the highadjust fixup */ + DPRINT("TYPE_RELOC_HIGHADJ fixup not implemented" + ", sorry\n"); + return(STATUS_UNSUCCESSFUL); + default: - DPRINT("unexpected fixup type\n"); - return 0; + DPRINT("unexpected fixup type\n"); + return(STATUS_UNSUCCESSFUL); } - } - RelocationRVA += RelocationDir->SizeOfBlock; - RelocationDir = (PRELOCATION_DIRECTORY)(ImageBase + - RelocationRVA); - } - } - } + } + RelocationRVA += RelocationDir->SizeOfBlock; + RelocationDir = (PRELOCATION_DIRECTORY)(ImageBase + + RelocationRVA); + } + } + return(STATUS_SUCCESS); +} - /* FIXME: do import fixups/load required libraries */ - /* Resolve Import Library references */ - if (NTHeaders->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT]. - VirtualAddress != 0) - { - PIMAGE_IMPORT_MODULE_DIRECTORY ImportModuleDirectory; +static NTSTATUS LdrFixupImports(PIMAGE_NT_HEADERS NTHeaders, + DWORD ImageBase) +{ + PIMAGE_IMPORT_MODULE_DIRECTORY ImportModuleDirectory; + ULONG Ordinal; + PDLL Module; + NTSTATUS Status; + + /* Process each import module */ + ImportModuleDirectory = (PIMAGE_IMPORT_MODULE_DIRECTORY) + (ImageBase + NTHeaders->OptionalHeader. + DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress); + while (ImportModuleDirectory->dwRVAModuleName) + { + PVOID *ImportAddressList; + PULONG FunctionNameList; + DWORD pName; + PWORD pHint; + + Status = LdrFindDll(&Module, + (PCHAR)(ImageBase + + ImportModuleDirectory->dwRVAModuleName)); + if (!NT_SUCCESS(Status)) + { + return 0; + } + + /* Get the import address list */ + ImportAddressList = (PVOID *) + (NTHeaders->OptionalHeader.ImageBase + + ImportModuleDirectory->dwRVAFunctionAddressList); + + /* Get the list of functions to import */ + if (ImportModuleDirectory->dwRVAFunctionNameList != 0) + { + FunctionNameList = (PULONG) (ImageBase + + ImportModuleDirectory->dwRVAFunctionNameList); + } + else + { + FunctionNameList = (PULONG) (ImageBase + + ImportModuleDirectory->dwRVAFunctionAddressList); + } + + /* Walk through function list and fixup addresses */ + while(*FunctionNameList != 0L) + { + if ((*FunctionNameList) & 0x80000000) + { + Ordinal = (*FunctionNameList) & 0x7fffffff; + *ImportAddressList = LdrGetExportByOrdinal(Module, Ordinal); + } + else + { + pName = (DWORD)(ImageBase + *FunctionNameList + 2); + pHint = (PWORD)(ImageBase + *FunctionNameList); + + *ImportAddressList = LdrGetExportByName(Module,pName); + if ((*ImportAddressList) == NULL) + { + return(STATUS_UNSUCCESSFUL); + } + } + + ImportAddressList++; + FunctionNameList++; + } + ImportModuleDirectory++; + } + return(STATUS_SUCCESS); +} - /* Process each import module */ - ImportModuleDirectory = (PIMAGE_IMPORT_MODULE_DIRECTORY) - (ImageBase + NTHeaders->OptionalHeader. - DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress); - while (ImportModuleDirectory->dwRVAModuleName) - { - DWORD LibraryBase; - PIMAGE_DOS_HEADER LibDosHeader; - PIMAGE_NT_HEADERS LibNTHeaders; - PVOID *ImportAddressList; // was pImpAddr - PULONG FunctionNameList; - DWORD pName; - PWORD pHint; - - Status = LdrLoadDll(&Module, - (PCHAR)(ImageBase + - ImportModuleDirectory->dwRVAModuleName)); - if (!NT_SUCCESS(Status)) - { - return 0; - } - - /* Get the import address list */ - ImportAddressList = (PVOID *) - (NTHeaders->OptionalHeader.ImageBase + - ImportModuleDirectory->dwRVAFunctionAddressList); - - /* Get the list of functions to import */ - if (ImportModuleDirectory->dwRVAFunctionNameList != 0) - { - FunctionNameList = (PULONG) (ImageBase + - ImportModuleDirectory->dwRVAFunctionNameList); - } - else - { - FunctionNameList = (PULONG) (ImageBase + - ImportModuleDirectory->dwRVAFunctionAddressList); - } - - /* Walk through function list and fixup addresses */ - while(*FunctionNameList != 0L) - { - if ((*FunctionNameList) & 0x80000000) // hint - { -// *ImportAddressList = LibraryExports[(*FunctionNameList) & 0x7fffffff]; - DPRINT("Import by ordinal unimplemented\n"); - for(;;); - } - else // hint-name - { - pName = (DWORD)(ImageBase + *FunctionNameList + 2); - pHint = (PWORD)(ImageBase + *FunctionNameList); - - /* FIXME: verify name */ - - if (strcmp(pName,"vsprintf")==0) - { - DPRINT("Fixing up reference to %s at %x\n", - pName,ImportAddressList); - DPRINT("pHint %x\n",pHint); - } - - - - *ImportAddressList = LdrGetExport(Module,pName); - } - /* FIXME: verify value of hint */ - - ImportAddressList++; - FunctionNameList++; - } - ImportModuleDirectory++; - } - } - - /* FIXME: locate the entry point for the image */ - EntryPoint = NTHeaders->OptionalHeader.ImageBase + - NTHeaders->OptionalHeader.AddressOfEntryPoint; - - return EntryPoint; +static PEPFUNC LdrPEStartup(DWORD ImageBase, HANDLE SectionHandle) +{ + NTSTATUS Status; + PEPFUNC EntryPoint; + PIMAGE_DOS_HEADER DosHeader; + PIMAGE_NT_HEADERS NTHeaders; + + DosHeader = (PIMAGE_DOS_HEADER) ImageBase; + NTHeaders = (PIMAGE_NT_HEADERS)(ImageBase + DosHeader->e_lfanew); + + /* Initialize Image sections */ + LdrMapSections(ImageBase, SectionHandle, NTHeaders); + + if (ImageBase != (DWORD) NTHeaders->OptionalHeader.ImageBase) + { + Status = LdrPerformRelocations(NTHeaders, ImageBase); + if (!NT_SUCCESS(Status)) + { + return(NULL); + } + } + + if (NTHeaders->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT]. + VirtualAddress != 0) + { + Status = LdrFixupImports(NTHeaders, ImageBase); + if (!NT_SUCCESS(Status)) + { + return(NULL); + } + } + + EntryPoint = ImageBase + NTHeaders->OptionalHeader.AddressOfEntryPoint; + + return(EntryPoint); } diff --git a/reactos/lib/ntdll/rtl/heap.c b/reactos/lib/ntdll/rtl/heap.c index 715140aed41..9c915d0f1f5 100644 --- a/reactos/lib/ntdll/rtl/heap.c +++ b/reactos/lib/ntdll/rtl/heap.c @@ -29,7 +29,7 @@ #include #include -//#define NDEBUG +#define NDEBUG #include #define HEAP_VALIDATE @@ -753,7 +753,7 @@ PVOID STDCALL RtlAllocateHeap(HANDLE Heap, DPRINT("HeapAlloc(hheap 0x%lX, flags 0x%lX, size 0x%lX )\n", (ULONG) Heap, Flags, (ULONG) Size ); #ifdef HEAP_VALIDATE - HeapValidate(Heap, 0, 0); + RtlValidateHeap(Heap, 0, 0); #endif if(( Flags | pheap->Flags) & HEAP_NO_SERIALIZE ) RtlEnterCriticalSection(&(pheap->Synchronize)); @@ -768,7 +768,7 @@ PVOID STDCALL RtlAllocateHeap(HANDLE Heap, DPRINT("HeapAlloc returns 0x%lX\n", (ULONG) retval); - HeapValidate(Heap, 0, 0); + RtlValidateHeap(Heap, 0, 0); return retval; @@ -788,7 +788,7 @@ LPVOID STDCALL RtlReAllocHeap(HANDLE hheap, DWORD flags, LPVOID ptr, DPRINT("HeapReAlloc( 0x%lX, 0x%lX, 0x%lX, 0x%lX )\n", (ULONG) hheap, flags, (ULONG) ptr, size ); #ifdef HEAP_VALIDATE - HeapValidate(hheap, 0, 0); + RtlValidateHeap(hheap, 0, 0); #endif if(( flags | pheap->Flags) & HEAP_NO_SERIALIZE ) RtlEnterCriticalSection(&(pheap->Synchronize)); @@ -821,7 +821,7 @@ BOOLEAN STDCALL RtlFreeHeap(HANDLE Heap, ULONG Flags, PVOID Address) DPRINT("HeapFree( 0x%lX, 0x%lX, 0x%lX )\n", (ULONG) Heap, Flags, (ULONG) Address ); #ifdef HEAP_VALIDATE - HeapValidate(Heap, 0, 0); + RtlValidateHeap(Heap, 0, 0); #endif if(( Flags | pheap->Flags) & HEAP_NO_SERIALIZE ) RtlEnterCriticalSection(&(pheap->Synchronize)); @@ -849,9 +849,9 @@ BOOLEAN STDCALL RtlFreeHeap(HANDLE Heap, ULONG Flags, PVOID Address) /********************************************************************* * GetProcessHeap -- KERNEL32 * *********************************************************************/ -HANDLE WINAPI GetProcessHeap(VOID) +HANDLE WINAPI RtlGetProcessHeap(VOID) { - DPRINT("GetProcessHeap()\n"); + DPRINT("RtlGetProcessHeap()\n"); return (HANDLE) __ProcessHeap; } @@ -891,7 +891,6 @@ DWORD WINAPI RtlEnumProcessHeaps(DWORD maxheaps, PHANDLE phandles ) /********************************************************************* * HeapLock -- KERNEL32 * *********************************************************************/ - BOOL WINAPI RtlLockHeap(HANDLE hheap) { PHEAP pheap=hheap; @@ -905,7 +904,6 @@ BOOL WINAPI RtlLockHeap(HANDLE hheap) /********************************************************************* * HeapUnlock -- KERNEL32 * *********************************************************************/ - BOOL WINAPI RtlUnlockHeap(HANDLE hheap) { PHEAP pheap=hheap; @@ -922,7 +920,6 @@ BOOL WINAPI RtlUnlockHeap(HANDLE hheap) * NT uses this function to compact moveable blocks and other things * * Here it does not compact, but it finds the largest free region * *********************************************************************/ - UINT RtlCompactHeap(HANDLE hheap, DWORD flags) { PHEAP pheap=hheap; @@ -955,7 +952,7 @@ UINT RtlCompactHeap(HANDLE hheap, DWORD flags) /********************************************************************* * HeapSize -- KERNEL32 * *********************************************************************/ -DWORD WINAPI HeapSize(HANDLE hheap, DWORD flags, LPCVOID pmem) +DWORD WINAPI RtlSizeHeap(HANDLE hheap, DWORD flags, LPCVOID pmem) { PHEAP pheap=(PHEAP) hheap; PHEAP_BLOCK palloc=((PHEAP_BLOCK)pmem-1); @@ -995,7 +992,7 @@ DWORD WINAPI HeapSize(HANDLE hheap, DWORD flags, LPCVOID pmem) * * * NOTE: only implemented in NT * *********************************************************************/ -BOOL WINAPI HeapValidate(HANDLE hheap, DWORD flags, LPCVOID pmem) +BOOL WINAPI RtlValidateHeap(HANDLE hheap, DWORD flags, LPCVOID pmem) { PHEAP pheap=(PHEAP)hheap; PHEAP_BLOCK pcheck; diff --git a/reactos/lib/ntdll/rtl/unicode.c b/reactos/lib/ntdll/rtl/unicode.c index 83f25eac711..f8dedf60619 100644 --- a/reactos/lib/ntdll/rtl/unicode.c +++ b/reactos/lib/ntdll/rtl/unicode.c @@ -43,32 +43,36 @@ ULONG RtlAnsiStringToUnicodeSize(IN PANSI_STRING AnsiString) } NTSTATUS RtlAnsiStringToUnicodeString(IN OUT PUNICODE_STRING DestinationString, - IN PANSI_STRING SourceString, IN BOOLEAN AllocateDestinationString) + IN PANSI_STRING SourceString, + IN BOOLEAN AllocateDestinationString) { - unsigned long i; + unsigned long i; - if(AllocateDestinationString==TRUE) { -// DestinationString->Buffer=ExAllocatePool(NonPagedPool, (SourceString->Length+1)*2); - DestinationString->MaximumLength=SourceString->Length; - }; + if (AllocateDestinationString == TRUE) + { + DestinationString->Buffer=RtlAllocateHeap(RtlGetProcessHeap(), + 0, + (SourceString->Length+1)*2); + DestinationString->MaximumLength=SourceString->Length; + } - DestinationString->Length=SourceString->Length; - memset(DestinationString->Buffer, 0, SourceString->Length*2); - - for (i=0; iLength; i++) - { - *DestinationString->Buffer=*SourceString->Buffer; - - SourceString->Buffer++; - DestinationString->Buffer++; - }; - *DestinationString->Buffer=0; - - SourceString->Buffer-=SourceString->Length; - DestinationString->Buffer-=SourceString->Length; - - return STATUS_SUCCESS; -}; + DestinationString->Length=SourceString->Length; + memset(DestinationString->Buffer, 0, SourceString->Length*2); + + for (i=0; iLength; i++) + { + *DestinationString->Buffer=*SourceString->Buffer; + + SourceString->Buffer++; + DestinationString->Buffer++; + } + *DestinationString->Buffer=0; + + SourceString->Buffer-=SourceString->Length; + DestinationString->Buffer-=SourceString->Length; + + return STATUS_SUCCESS; +} NTSTATUS RtlAppendUnicodeStringToString(IN OUT PUNICODE_STRING Destination, IN PUNICODE_STRING Source) @@ -313,18 +317,21 @@ VOID RtlFreeUnicodeString(IN PUNICODE_STRING UnicodeString) VOID RtlInitAnsiString(IN OUT PANSI_STRING DestinationString, IN PCSZ SourceString) { - unsigned long DestSize; - - if(SourceString==NULL) { - DestinationString->Length=0; - DestinationString->MaximumLength=0; - } else { - DestSize=strlen((const char *)SourceString); - DestinationString->Length=DestSize; - DestinationString->MaximumLength=DestSize+1; - }; - DestinationString->Buffer=(PCHAR)SourceString; -}; + unsigned long DestSize; + + if(SourceString==NULL) + { + DestinationString->Length=0; + DestinationString->MaximumLength=0; + } + else + { + DestSize=strlen((const char *)SourceString); + DestinationString->Length=DestSize; + DestinationString->MaximumLength=DestSize+1; + } + DestinationString->Buffer=(PCHAR)SourceString; +} VOID RtlInitString(IN OUT PSTRING DestinationString, IN PCSZ SourceString) diff --git a/reactos/makefile_rex b/reactos/makefile_rex index 179c567ea4f..1c814c06b0e 100644 --- a/reactos/makefile_rex +++ b/reactos/makefile_rex @@ -29,7 +29,7 @@ LOADERS = dos # # Select the device drivers and filesystems you want # -KERNEL_SERVICES = parallel keyboard blues null mouse serial sound ide test sdisk \ +KERNEL_SERVICES = parallel keyboard blues null mouse serial sound ide \ minix vfat ext2 APPS = hello shell args diff --git a/reactos/ntoskrnl/io/create.c b/reactos/ntoskrnl/io/create.c index 10cb2b028c9..1f1ec691332 100644 --- a/reactos/ntoskrnl/io/create.c +++ b/reactos/ntoskrnl/io/create.c @@ -188,7 +188,7 @@ NTSTATUS STDCALL ZwCreateFile(PHANDLE FileHandle, FileObject->Flags = FileObject->Flags | FO_SYNCHRONOUS_IO; } - KeInitializeEvent(&Event,NotificationEvent,FALSE); + KeInitializeEvent(&Event, NotificationEvent, FALSE); Irp = IoAllocateIrp(FileObject->DeviceObject->StackSize, FALSE); if (Irp==NULL) diff --git a/reactos/ntoskrnl/ke/main.c b/reactos/ntoskrnl/ke/main.c index cc470f36ea4..d311a260c97 100644 --- a/reactos/ntoskrnl/ke/main.c +++ b/reactos/ntoskrnl/ke/main.c @@ -174,15 +174,8 @@ asmlinkage void _main(boot_param* _bp) */ LdrLoadAutoConfigDrivers(); -#ifdef KRNL_TEST - /* - * Test various features of the kernel - */ - TstBegin(); -#endif - /* - * Launch initial thread + * Launch initial process */ LdrLoadInitialProcess(); diff --git a/reactos/ntoskrnl/makefile_rex b/reactos/ntoskrnl/makefile_rex index 7b673417aa4..f103a2430d5 100644 --- a/reactos/ntoskrnl/makefile_rex +++ b/reactos/ntoskrnl/makefile_rex @@ -1,4 +1,4 @@ -all: ntoskrnl.exe utils/pe2bin/pe2bin$(EXE_POSTFIX) +all: objects ntoskrnl.exe # # Defines $(HAL_OBJECTS) @@ -45,14 +45,15 @@ SE_OBJECTS = se/semgr.o CM_OBJECTS = cm/registry.o -TST_OBJECTS = tst/test.o - DBG_OBJECTS = dbg/brkpoint.o dbg/errinfo.o LDR_OBJECTS = ldr/loader.o CC_OBJECTS = cc/cacheman.o cc/block.o +objects: ../ntoskrnl/objects + mkdir objects + objects/hal.o: $(HAL_OBJECTS) $(LD) -r $(HAL_OBJECTS) -o objects/hal.o @@ -83,9 +84,6 @@ objects/se.o: $(SE_OBJECTS) objects/cm.o: $(CM_OBJECTS) $(LD) -r $(CM_OBJECTS) -o objects/cm.o -objects/tst.o: $(TST_OBJECTS) - $(LD) -r $(TST_OBJECTS) -o objects/tst.o - objects/dbg.o: $(DBG_OBJECTS) $(LD) -r $(DBG_OBJECTS) -o objects/dbg.o @@ -100,12 +98,9 @@ objects/cc.o: $(CC_OBJECTS) OBJECTS = objects/hal.o objects/ke.o objects/rtl.o objects/mm.o \ objects/io.o objects/ob.o objects/ps.o objects/ex.o \ - objects/se.o objects/cm.o objects/tst.o objects/dbg.o\ + objects/se.o objects/cm.o objects/dbg.o\ objects/nt.o objects/cc.o objects/ldr.o -utils/pe2bin/pe2bin$(EXE_POSTFIX): utils/pe2bin/pe2bin.c - $(NATIVE_CC) -I../include -g utils/pe2bin/pe2bin.c -o utils/pe2bin/pe2bin$(EXE_POSTFIX) - utils/export/export$(EXE_POSTFIX): utils/export/export.c $(NATIVE_CC) -g utils/export/export.c -o utils/export/export$(EXE_POSTFIX)