Changeset 506 for trunk/src


Ignore:
Timestamp:
Aug 16, 1999, 3:56:54 PM (26 years ago)
Author:
sandervl
Message:

* empty log message *

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:19 sandervl Exp $
     1; $Id: KERNEL32.DEF,v 1.20 1999-08-16 13:54:32 sandervl Exp $
    22
    33;Created by BLAST for IBM's compiler
     
    980980   GetThreadTHDB        = _GetThreadTHDB@0                         @1235
    981981
     982   CreateWin32Exe       = _CreateWin32Exe@4                        @1236
     983
    982984; HEAP Management (heap.cpp, heapstring.cpp)
    983985    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:10 sandervl Exp $ */
     1/* $Id: winexe.cpp,v 1.9 1999-08-16 13:54:32 sandervl Exp $ */
    22
    33/*
     
    3434Win32Exe *WinExe = NULL;
    3535
     36//******************************************************************************
     37//Called by ring 3 pe loader to create win32 executable
     38//******************************************************************************
     39Win32Exe* WIN32API CreateWin32Exe(char *szFileName)
     40{
     41  return new Win32Exe(szFileName);
     42}
    3643//******************************************************************************
    3744//******************************************************************************
  • trunk/src/peldr/makefile

    r458 r506  
    1 # $Id: makefile,v 1.4 1999-08-09 21:03:19 phaller Exp $
     1# $Id: makefile,v 1.5 1999-08-16 13:54:06 sandervl Exp $
    22
    33#
     
    1717CFLAGS = $(CFLAGS) -Ge+ /Gd-  -I$(PDWIN32_INCLUDE)
    1818CXXFLAGS = $(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.lib
     19LDFLAGSEXE = $(LDFLAGS) -Ge+ /B"/pmtype:pm /stack:0x30000 /NOBASE /Map" \
     20             $(PDWIN32_LIB)\peldr.lib os2386.lib $(PDWIN32_LIB)\odincrt.lib cppom30.lib
    2121
    2222TARGET = pe
     23TARGETDLL = peldr
    2324
    2425OBJS =  pe.obj
     26OBJSDLL =  initterm.obj
    2527
    26 all: $(TARGET).exe
     28all: $(TARGETDLL).dll $(TARGETDLL).lib $(TARGET).exe
    2729
    2830
    2931$(TARGET).exe: $(OBJS)
    30         $(LD) $(LDFLAGS) -Fe$@ $(OBJS)
     32        $(LD) $(LDFLAGSEXE) -Fe$@ $(OBJS)
    3133        $(CP) $(TARGET).exe $(PDWIN32_BIN)
    3234
     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)
    3342
    3443
     44initterm.obj: initterm.cpp
    3545misc.obj: misc.cpp
    3646pe.obj: pe.cpp pe.h $(PDWIN32_INCLUDE)\winimage.h $(PDWIN32_INCLUDE)\winexe.h
     
    3949        $(RM) *.obj *.lib *.dll *~ *.map *.pch *.exe
    4050        $(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:13 sandervl Exp $ */
     1/* $Id: pe.cpp,v 1.5 1999-08-16 13:54:07 sandervl Exp $ */
    22
    3 /*
    4  *
    5  * Project Odin Software License can be found in LICENSE.TXT
    6  *
    7  */
    83/*
    94 * PELDR main exe loader code
    105 *
    116 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
     7 *
     8 *
     9 * Project Odin Software License can be found in LICENSE.TXT
    1210 *
    1311 */
     
    1614#define INCL_DOSPROCESS          /* DOS Process values       */
    1715#define INCL_DOSMISC             /* DOS Miscellanous values  */
     16#define INCL_DOSMODULEMGR
    1817#define INCL_WIN
    19 #include <os2wrap.h>    //Odin32 OS/2 api wrappers
     18#include <os2.h>
     19#include <bseord.h>
    2020#include <stdio.h>
    2121#include <string.h>
     
    2828#include <windll.h>
    2929#include <wprocess.h>
     30#include "pe.h"
    3031
    3132char INFO_BANNER[]      = "Usage: PE winexe commandline";
     
    4041char fullpath[CCHMAXPATH];
    4142
    42 void UpCase(char *mixedcase);
     43typedef HAB  (* APIENTRY WININITIALIZEPROC)(ULONG flOptions);
     44typedef BOOL (* APIENTRY WINTERMINATEPROC)(HAB hab);
     45typedef HMQ  (* APIENTRY WINCREATEMSGQUEUEPROC) (HAB hab, LONG cmsg);
     46typedef BOOL (* APIENTRY WINDESTROYMSGQUEUEPROC) (HMQ hmq);
     47typedef ULONG (* APIENTRY WINMESSAGEBOXPROC) (HWND hwndParent,
     48                                              HWND hwndOwner,
     49                                              PCSZ  pszText,
     50                                              PCSZ  pszCaption,
     51                                              ULONG idWindow,
     52                                              ULONG flStyle);
     53
     54WININITIALIZEPROC      MyWinInitialize      = 0;
     55WINTERMINATEPROC       MyWinTerminate       = 0;
     56WINCREATEMSGQUEUEPROC  MyWinCreateMsgQueue  = 0;
     57WINDESTROYMSGQUEUEPROC MyWinDestroyMsgQueue = 0;
     58WINMESSAGEBOXPROC      MyWinMessageBox      = 0;
     59
     60WIN32CTOR              CreateWin32Exe       = 0;
    4361
    4462int main(int argc, char *argv[])
     
    5169 PTIB   ptib;
    5270 Win32Exe *WinExe;
    53  APIRET rc;
     71 APIRET  rc;
     72 HMODULE hmodPMWin, hmodKernel32;
    5473
    55   if ((hab = WinInitialize(0)) == 0L) /* Initialize PM     */
    56         return(1);
     74  printf("memory allocated at %X\n", ReserveMem());
    5775
    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);
    5982
     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 
    6091  if(argc < 2) {
    61         WinMessageBox(HWND_DESKTOP, NULL, INFO_BANNER, szErrorTitle, 0, MB_OK | MB_ERROR | MB_MOVEABLE);
    62         return(0);
     92        MyWinMessageBox(HWND_DESKTOP, NULL, INFO_BANNER, szErrorTitle, 0, MB_OK | MB_ERROR | MB_MOVEABLE);
     93        return(0);
    6394  }
    6495
    6596  strcpy(exeName, argv[1]);
    66   UpCase(exeName);
     97  strupr(exeName);
    6798  if(strstr(exeName, ".EXE") == NULL) {
    6899        strcat(exeName, ".EXE");
    69100  }
    70   WinExe = new Win32Exe(exeName);
     101  WinExe = CreateWin32Exe(exeName);
    71102  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);
    73104        return(1);
    74105  }
    75106  rc = DosGetInfoBlocks(&ptib, &ppib);
    76107  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);
    78109        delete WinExe;
    79110        return(1);
     
    107138  delete WinExe;
    108139
    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);
    111145  return(0);
    112146}
    113147//******************************************************************************
    114148//******************************************************************************
    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 phaller Exp $ */
     1/* $Id: pe.h,v 1.4 1999-08-16 13:54:07 sandervl Exp $ */
    22
    33/*
     
    2323extern char szInteralErrorMsg[];
    2424
    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
     25ULONG SYSTEM ReserveMem();
    3726
    3827#endif // NOIMAGE
Note: See TracChangeset for help on using the changeset viewer.