home *** CD-ROM | disk | FTP | other *** search
/ Visual Home / Visual_Home_Books_That_Work_1996.iso / dll / w32schk.c < prev    next >
C/C++ Source or Header  |  1995-07-12  |  4KB  |  111 lines

  1. // Function: LibMain
  2. //
  3. // Purpose: C function called from DLL entry point.
  4. //
  5. // Parameters: HINSTANCE hInst;   DLL instance handle
  6. //             WORD wSeg;         DLL data segment selector
  7. //             WORD cbHeapSize;   DLL initial heap size in bytes
  8. //             LPSTR lpszCmdLine; DLL command line
  9. //
  10. // Returns: 1 is success, 0 fail DLL load
  11. //
  12. // Comments:
  13. //
  14. // History:  Date       Author        Reason
  15. //
  16. ///////////////////////////////////////////////////////////////////////////////////////
  17. #include <windows.h>
  18. #include <string.h>
  19.  
  20.  
  21. int  LibMain(HINSTANCE hInst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine)
  22. {
  23.   return(1);
  24. }
  25.  
  26. //***********************************************************************
  27. // Function: 
  28. //
  29. // Purpose: Check for support of at least 256 color display
  30. //
  31. // Parameters: 
  32. // LPDLLCALLPARAMS lpDllParams; Parameters from Wise
  33. //
  34. // Returns: TRUE if Windows version is not between 3.1 and 4.0
  35.  
  36. // Comments:
  37. //
  38. // History:  Date       Author        Reason
  39. //
  40. //****************************************************************************BOOL FAR PASCAL IsWin32s11Loaded(LPSTR szVersion)
  41.  
  42. typedef struct {
  43.    WORD wStructLen;    // The length of the structure
  44.    HWND hWnd;          // Handle to main window
  45.    WORD wMaxReplaces;  // Maximum number of replaces
  46.    WORD wRepNameWidth; // The width of a replace name
  47.    WORD wRepStrWidth;  // The width of each replace string
  48.    WORD wCurrReps;     // Current number of replace strings
  49.    char *lpszRepName;  // The actual replace names
  50.    char *lpszRepStr;   // The actual replace values
  51.    BYTE bRunMode;      // The installation mode
  52.    HFILE fLogFile;     // A file handle to the log file
  53.    char *lpszParam;    // String parameter from Wise Installation System
  54. } DLLCALLPARAMS;
  55. typedef DLLCALLPARAMS far *LPDLLCALLPARAMS;
  56.  
  57. typedef struct {
  58.     BYTE bMajor;
  59.     BYTE bMinor;
  60.     WORD wBuildNumber;
  61.     BOOL fDebug;
  62. } WIN32SINFO, far * LPWIN32SINFO;
  63.  
  64.  
  65. BOOL FAR PASCAL _export mustLoadWin32s( LPDLLCALLPARAMS params )
  66. {
  67.     BOOL              mustLoadWin32s = TRUE;  // assume failure
  68.     FARPROC           pfnInfo;
  69.     HANDLE            hWin32sys;
  70.     WIN32SINFO        Info;
  71.     char              buffer[64];
  72.    
  73.     //lstrcpy(libPath, params->lpszParam);
  74.      //lstrcat(libPath, "\\W32SYS.DLL");   /* This will fail if temp is the ROOT (e.g., C:\) */
  75.  
  76.     hWin32sys = LoadLibrary(params->lpszParam);
  77.     if (hWin32sys > HINSTANCE_ERROR) {
  78.         pfnInfo = GetProcAddress(hWin32sys, "GETWIN32SINFO");
  79.         if (pfnInfo) {
  80.             // Win32s version is installed
  81.             if (!(*pfnInfo)((LPWIN32SINFO) &Info)) {
  82.                 mustLoadWin32s = FALSE;
  83.                 #if 0
  84.                     // Now check version number
  85.                     if ((Info.bMajor > 1) ||  ((Info.bMajor == 1) && (Info.bMinor >= 25))) {
  86.                             mustLoadWin32s = FALSE;
  87.                     }
  88.                 #endif
  89.                 #if 0
  90.                     wsprintf(buffer, "%d.%d.%d.0",
  91.                          Info.bMajor, Info.bMinor, Info.wBuildNumber);
  92.                     MessageBox(params->hWnd, buffer, "Win32s Version", MB_OK);
  93.                 #endif
  94.              } else {
  95.                 #if 0
  96.                      MessageBox(params->hWnd, "Pinfo function return false", "Win32s Version", MB_OK);
  97.                 #endif
  98.              }
  99.         } else {
  100.                 #if 0
  101.                      MessageBox(params->hWnd, "No pinfo", "Win32s Version", MB_OK);
  102.                 #endif
  103.         }
  104.         FreeLibrary( hWin32sys );
  105.     } else {
  106.         #if 0
  107.             MessageBox(params->hWnd, params->lpszParam, "No Win32s Lib", MB_OK);
  108.         #endif
  109.     }
  110.     return mustLoadWin32s;
  111. }