- Timestamp:
- Aug 16, 1999, 3:56:54 PM (26 years ago)
- Location:
- trunk/src
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/KERNEL32.DEF
r493 r506 1 ; $Id: KERNEL32.DEF,v 1. 19 1999-08-13 18:38:19sandervl Exp $1 ; $Id: KERNEL32.DEF,v 1.20 1999-08-16 13:54:32 sandervl Exp $ 2 2 3 3 ;Created by BLAST for IBM's compiler … … 980 980 GetThreadTHDB = _GetThreadTHDB@0 @1235 981 981 982 CreateWin32Exe = _CreateWin32Exe@4 @1236 983 982 984 ; HEAP Management (heap.cpp, heapstring.cpp) 983 985 HEAP_xalloc = _HEAP_xalloc@12 @1240 -
trunk/src/kernel32/winexe.cpp
r281 r506 1 /* $Id: winexe.cpp,v 1. 8 1999-07-07 08:11:10sandervl Exp $ */1 /* $Id: winexe.cpp,v 1.9 1999-08-16 13:54:32 sandervl Exp $ */ 2 2 3 3 /* … … 34 34 Win32Exe *WinExe = NULL; 35 35 36 //****************************************************************************** 37 //Called by ring 3 pe loader to create win32 executable 38 //****************************************************************************** 39 Win32Exe* WIN32API CreateWin32Exe(char *szFileName) 40 { 41 return new Win32Exe(szFileName); 42 } 36 43 //****************************************************************************** 37 44 //****************************************************************************** -
trunk/src/peldr/makefile
r458 r506 1 # $Id: makefile,v 1. 4 1999-08-09 21:03:19 phallerExp $1 # $Id: makefile,v 1.5 1999-08-16 13:54:06 sandervl Exp $ 2 2 3 3 # … … 17 17 CFLAGS = $(CFLAGS) -Ge+ /Gd- -I$(PDWIN32_INCLUDE) 18 18 CXXFLAGS = $(CXXFLAGS) -Ge+ /Gd- -I$(PDWIN32_INCLUDE) 19 LDFLAGS = $(LDFLAGS) -Ge+ /B"/pmtype:pm /stack:0x30000 /NOBASE /Map" \20 ..\..\lib\kernel32.lib os2386.lib ..\..\lib\odincrt.lib cppom30.lib19 LDFLAGSEXE = $(LDFLAGS) -Ge+ /B"/pmtype:pm /stack:0x30000 /NOBASE /Map" \ 20 $(PDWIN32_LIB)\peldr.lib os2386.lib $(PDWIN32_LIB)\odincrt.lib cppom30.lib 21 21 22 22 TARGET = pe 23 TARGETDLL = peldr 23 24 24 25 OBJS = pe.obj 26 OBJSDLL = initterm.obj 25 27 26 all: $(TARGET ).exe28 all: $(TARGETDLL).dll $(TARGETDLL).lib $(TARGET).exe 27 29 28 30 29 31 $(TARGET).exe: $(OBJS) 30 $(LD) $(LDFLAGS ) -Fe$@ $(OBJS)32 $(LD) $(LDFLAGSEXE) -Fe$@ $(OBJS) 31 33 $(CP) $(TARGET).exe $(PDWIN32_BIN) 32 34 35 $(TARGETDLL).dll: $(OBJSDLL) $(TARGETDLL).def 36 $(LD) $(LDFLAGS) -Fe$@ $(OBJSDLL) sbsstub.obj $(TARGETDLL).def OS2386.LIB CPPOM30.LIB 37 $(CP) $@ $(PDWIN32_BIN) 38 39 $(TARGETDLL).lib: $(TARGETDLL).dll 40 $(IMPLIB) $(IMPLIBFLAGS) $@ $(TARGETDLL).dll 41 $(CP) $@ $(PDWIN32_LIB) 33 42 34 43 44 initterm.obj: initterm.cpp 35 45 misc.obj: misc.cpp 36 46 pe.obj: pe.cpp pe.h $(PDWIN32_INCLUDE)\winimage.h $(PDWIN32_INCLUDE)\winexe.h … … 39 49 $(RM) *.obj *.lib *.dll *~ *.map *.pch *.exe 40 50 $(RM) $(PDWIN32_BIN)\$(TARGET).exe 51 $(RM) $(PDWIN32_BIN)\$(TARGETDLL).dll 52 $(RM) $(PDWIN32_LIB)\$(TARGETDLL).lib -
trunk/src/peldr/pe.cpp
r131 r506 1 /* $Id: pe.cpp,v 1. 4 1999-06-20 14:02:13sandervl Exp $ */1 /* $Id: pe.cpp,v 1.5 1999-08-16 13:54:07 sandervl Exp $ */ 2 2 3 /*4 *5 * Project Odin Software License can be found in LICENSE.TXT6 *7 */8 3 /* 9 4 * PELDR main exe loader code 10 5 * 11 6 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl) 7 * 8 * 9 * Project Odin Software License can be found in LICENSE.TXT 12 10 * 13 11 */ … … 16 14 #define INCL_DOSPROCESS /* DOS Process values */ 17 15 #define INCL_DOSMISC /* DOS Miscellanous values */ 16 #define INCL_DOSMODULEMGR 18 17 #define INCL_WIN 19 #include <os2wrap.h> //Odin32 OS/2 api wrappers 18 #include <os2.h> 19 #include <bseord.h> 20 20 #include <stdio.h> 21 21 #include <string.h> … … 28 28 #include <windll.h> 29 29 #include <wprocess.h> 30 #include "pe.h" 30 31 31 32 char INFO_BANNER[] = "Usage: PE winexe commandline"; … … 40 41 char fullpath[CCHMAXPATH]; 41 42 42 void UpCase(char *mixedcase); 43 typedef HAB (* APIENTRY WININITIALIZEPROC)(ULONG flOptions); 44 typedef BOOL (* APIENTRY WINTERMINATEPROC)(HAB hab); 45 typedef HMQ (* APIENTRY WINCREATEMSGQUEUEPROC) (HAB hab, LONG cmsg); 46 typedef BOOL (* APIENTRY WINDESTROYMSGQUEUEPROC) (HMQ hmq); 47 typedef ULONG (* APIENTRY WINMESSAGEBOXPROC) (HWND hwndParent, 48 HWND hwndOwner, 49 PCSZ pszText, 50 PCSZ pszCaption, 51 ULONG idWindow, 52 ULONG flStyle); 53 54 WININITIALIZEPROC MyWinInitialize = 0; 55 WINTERMINATEPROC MyWinTerminate = 0; 56 WINCREATEMSGQUEUEPROC MyWinCreateMsgQueue = 0; 57 WINDESTROYMSGQUEUEPROC MyWinDestroyMsgQueue = 0; 58 WINMESSAGEBOXPROC MyWinMessageBox = 0; 59 60 WIN32CTOR CreateWin32Exe = 0; 43 61 44 62 int main(int argc, char *argv[]) … … 51 69 PTIB ptib; 52 70 Win32Exe *WinExe; 53 APIRET rc; 71 APIRET rc; 72 HMODULE hmodPMWin, hmodKernel32; 54 73 55 if ((hab = WinInitialize(0)) == 0L) /* Initialize PM */ 56 return(1); 74 printf("memory allocated at %X\n", ReserveMem()); 57 75 58 hmq = WinCreateMsgQueue(hab, 0); 76 rc = DosLoadModule(exeName, sizeof(exeName), "PMWIN.DLL", &hmodPMWin); 77 rc = DosQueryProcAddr(hmodPMWin, ORD_WIN32INITIALIZE, NULL, (PFN *)&MyWinInitialize); 78 rc = DosQueryProcAddr(hmodPMWin, ORD_WIN32TERMINATE, NULL, (PFN *)&MyWinTerminate); 79 rc = DosQueryProcAddr(hmodPMWin, ORD_WIN32CREATEMSGQUEUE, NULL, (PFN *)&MyWinCreateMsgQueue); 80 rc = DosQueryProcAddr(hmodPMWin, ORD_WIN32DESTROYMSGQUEUE, NULL, (PFN *)&MyWinDestroyMsgQueue); 81 rc = DosQueryProcAddr(hmodPMWin, ORD_WIN32MESSAGEBOX, NULL, (PFN *)&MyWinMessageBox); 59 82 83 rc = DosLoadModule(exeName, sizeof(exeName), "KERNEL32.DLL", &hmodKernel32); 84 rc = DosQueryProcAddr(hmodKernel32, 0, "CreateWin32Exe", (PFN *)&CreateWin32Exe); 85 86 if ((hab = MyWinInitialize(0)) == 0L) /* Initialize PM */ 87 return(1); 88 89 hmq = MyWinCreateMsgQueue(hab, 0); 90 60 91 if(argc < 2) { 61 62 92 MyWinMessageBox(HWND_DESKTOP, NULL, INFO_BANNER, szErrorTitle, 0, MB_OK | MB_ERROR | MB_MOVEABLE); 93 return(0); 63 94 } 64 95 65 96 strcpy(exeName, argv[1]); 66 UpCase(exeName);97 strupr(exeName); 67 98 if(strstr(exeName, ".EXE") == NULL) { 68 99 strcat(exeName, ".EXE"); 69 100 } 70 WinExe = newWin32Exe(exeName);101 WinExe = CreateWin32Exe(exeName); 71 102 if(WinExe == NULL) { 72 WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, szMemErrorMsg, szErrorTitle, 0, MB_OK | MB_ERROR | MB_MOVEABLE);103 MyWinMessageBox(HWND_DESKTOP, HWND_DESKTOP, szMemErrorMsg, szErrorTitle, 0, MB_OK | MB_ERROR | MB_MOVEABLE); 73 104 return(1); 74 105 } 75 106 rc = DosGetInfoBlocks(&ptib, &ppib); 76 107 if(rc) { 77 WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, szInteralErrorMsg, szErrorTitle, 0, MB_OK | MB_ERROR | MB_MOVEABLE);108 MyWinMessageBox(HWND_DESKTOP, HWND_DESKTOP, szInteralErrorMsg, szErrorTitle, 0, MB_OK | MB_ERROR | MB_MOVEABLE); 78 109 delete WinExe; 79 110 return(1); … … 107 138 delete WinExe; 108 139 109 if(hmq) WinDestroyMsgQueue( hmq ); /* Tidy up... */ 110 WinTerminate( hab ); /* Terminate the application */ 140 if(hmq) MyWinDestroyMsgQueue( hmq ); /* Tidy up... */ 141 MyWinTerminate( hab ); /* Terminate the application */ 142 143 DosFreeModule(hmodPMWin); 144 DosFreeModule(hmodKernel32); 111 145 return(0); 112 146 } 113 147 //****************************************************************************** 114 148 //****************************************************************************** 115 void UpCase(char *mixedcase)116 {117 int i;118 119 for(i=0;i<strlen(mixedcase);i++) {120 if(mixedcase[i] >= 'a' && mixedcase[i] <= 'z') {121 mixedcase[i] += 'A' - 'a';122 }123 }124 }125 //******************************************************************************126 //****************************************************************************** -
trunk/src/peldr/pe.h
r96 r506 1 /* $Id: pe.h,v 1. 3 1999-06-10 16:56:36 phallerExp $ */1 /* $Id: pe.h,v 1.4 1999-08-16 13:54:07 sandervl Exp $ */ 2 2 3 3 /* … … 23 23 extern char szInteralErrorMsg[]; 24 24 25 #define DWORD ULONG 26 #define LPVOID VOID * 27 #define WORD USHORT 28 #define UNALIGNED 29 #define PDWORD DWORD * 30 #define PWORD WORD * 31 #define NTAPI 32 #define BOOLEAN ULONG 33 #define WCHAR USHORT 34 #define HANDLE ULONG 35 36 #define WIN32API __stdcall 25 ULONG SYSTEM ReserveMem(); 37 26 38 27 #endif // NOIMAGE
Note:
See TracChangeset
for help on using the changeset viewer.