home *** CD-ROM | disk | FTP | other *** search
/ The Elite Hackers Toolkit / TheEliteHackersToolkitVolume1_1998.rar / HACKERS.BIN / appcraks / P5WGLIDE.ZIP / IMPORTS.C < prev    next >
C/C++ Source or Header  |  1998-01-06  |  5KB  |  174 lines

  1. // imports.c
  2.  
  3. // Loads the original "glide2x.dll" and retrieves the procedure addresses for the functions
  4. // that will be exported in exports.c. 
  5.  
  6. // Copr. 1998 - Justin Frankel/Nullsoft, Inc. (http://www.nullsoft.com)
  7.  
  8. #include <windows.h>
  9.  
  10. #define FX_GLIDE_NO_FUNC_PROTO
  11. #include <glide.h>
  12. #include <glideutl.h>
  13.  
  14.  
  15. #define IMPORTS_C
  16. #include "pointers.h"
  17.  
  18.  
  19. // loads a function "name", that has a parameter list of "parmsize" bytes.
  20. #define LOADFUNC(name,parmsize)    \
  21.     ( _##name ) = (void *) GetProcAddress(*hGlide,"_" #name "@" #parmsize);    \
  22.     if (!( _##name ))    \
  23.     {    \
  24.         FreeModule(*hGlide);        \
  25.         MessageBox(NULL,"Error loading symbol \"" #name "\" from glide2x.dll", "Error loading WinGlide", MB_OK|MB_ICONSTOP);        \
  26.         return FALSE;    \
  27.     }
  28.  
  29.  
  30. // load all our symbols. Return true on success, false on failure. Fill in hGlide with the handle of 
  31. // the original glide2x.dll
  32. int LoadSymbols(HINSTANCE *hGlide, HINSTANCE hDllInst)
  33. {
  34.     char str[512];
  35.     GetWindowsDirectory(str,sizeof(str)-1);
  36.     strcat(str,"\\glide2x.dll");
  37.     *hGlide = LoadLibrary(str);
  38.     if (!*hGlide || *hGlide == hDllInst) 
  39.     {
  40.         GetSystemDirectory(str,sizeof(str)-1);
  41.         strcat(str,"\\glide2x.dll");
  42.         *hGlide = LoadLibrary(str);
  43.         if (!*hGlide || *hGlide == hDllInst) 
  44.         {
  45.             MessageBox(NULL,"glide2x.dll not found in windows or system directories.","Error loading WinGlide",MB_OK|MB_ICONSTOP);
  46.             return FALSE;
  47.         }
  48.     }
  49.     LOADFUNC(grDrawLine,8);
  50.     LOADFUNC(grDrawPlanarPolygon,12);
  51.     LOADFUNC(grDrawPlanarPolygonVertexList,8);
  52.     LOADFUNC(grDrawPoint,4);
  53.     LOADFUNC(grDrawPolygon,12);
  54.     LOADFUNC(grDrawPolygonVertexList,8);
  55.     LOADFUNC(grDrawTriangle,12);
  56.     LOADFUNC(grBufferClear,12);
  57.     LOADFUNC(grBufferNumPending,0);
  58.     LOADFUNC(grBufferSwap,4);
  59.     LOADFUNC(grRenderBuffer,4);
  60.     LOADFUNC(grErrorSetCallback,4);
  61.     LOADFUNC(grSstIdle,0);
  62.     LOADFUNC(grSstVideoLine,0);
  63.     LOADFUNC(grSstVRetraceOn,0);
  64.     LOADFUNC(grSstIsBusy,0);
  65.     LOADFUNC(grSstWinOpen,28);
  66.     LOADFUNC(grSstWinClose,0);
  67.     LOADFUNC(grSstControl,4);
  68.     LOADFUNC(grSstQueryHardware,4);
  69.     LOADFUNC(grSstQueryBoards,4);
  70.     LOADFUNC(grSstOrigin,4);
  71.     LOADFUNC(grSstSelect,4);
  72.     LOADFUNC(grSstScreenHeight,0);
  73.     LOADFUNC(grSstScreenWidth,0);
  74.     LOADFUNC(grSstStatus,0);
  75.     LOADFUNC(grSstPerfStats,4);
  76.     LOADFUNC(grSstResetPerfStats,0);
  77.     LOADFUNC(grResetTriStats,0);
  78.     LOADFUNC(grTriStats,8);
  79.     LOADFUNC(grAlphaBlendFunction,16);
  80.     LOADFUNC(grAlphaCombine,20);
  81.     LOADFUNC(grAlphaControlsITRGBLighting,4);
  82.     LOADFUNC(grAlphaTestFunction,4);
  83.     LOADFUNC(grAlphaTestReferenceValue,4);
  84.     LOADFUNC(grChromakeyMode,4);
  85.     LOADFUNC(grChromakeyValue,4);
  86.     LOADFUNC(grClipWindow,16);
  87.     LOADFUNC(grColorCombine,20);
  88.     LOADFUNC(grColorMask,8);
  89.     LOADFUNC(grCullMode,4);
  90.     LOADFUNC(grConstantColorValue,4);
  91.     LOADFUNC(grConstantColorValue4,16);
  92.     LOADFUNC(grDepthBiasLevel,4);
  93.     LOADFUNC(grDepthBufferFunction,4);
  94.     LOADFUNC(grDepthBufferMode,4);
  95.     LOADFUNC(grDepthMask,4);
  96.     LOADFUNC(grDisableAllEffects,0);
  97.     LOADFUNC(grDitherMode,4);
  98.     LOADFUNC(grFogColorValue,4);
  99.     LOADFUNC(grFogMode,4);
  100.     LOADFUNC(grFogTable,4);
  101.     LOADFUNC(grGammaCorrectionValue,4);
  102.     LOADFUNC(grSplash,20);
  103.     LOADFUNC(grTexCalcMemRequired,16);
  104.     LOADFUNC(grTexTextureMemRequired,8);
  105.     LOADFUNC(grTexMinAddress,4);
  106.     LOADFUNC(grTexMaxAddress,4);
  107.     LOADFUNC(grTexNCCTable,8);
  108.     LOADFUNC(grTexSource,16);
  109.     LOADFUNC(grTexClampMode,12);
  110.     LOADFUNC(grTexCombine,28);
  111.     LOADFUNC(grTexCombineFunction,8);
  112.     LOADFUNC(grTexDetailControl,16);
  113.     LOADFUNC(grTexFilterMode,12);
  114.     LOADFUNC(grTexLodBiasValue,8);
  115.     LOADFUNC(grTexDownloadMipMap,16);
  116.     LOADFUNC(grTexDownloadMipMapLevel,32);
  117.     LOADFUNC(grTexDownloadMipMapLevelPartial,40);
  118.     LOADFUNC(grCheckForRoom,4);
  119.     LOADFUNC(grTexDownloadTable,12);
  120.     LOADFUNC(grTexDownloadTablePartial,20);
  121.     LOADFUNC(grTexMipMapMode,12);
  122.     LOADFUNC(grTexMultibase,8);
  123.     LOADFUNC(grTexMultibaseAddress,20);
  124.     LOADFUNC(grLfbLock,24);
  125.     LOADFUNC(grLfbUnlock,8);
  126.     LOADFUNC(grLfbConstantAlpha,4);
  127.     LOADFUNC(grLfbConstantDepth,4);
  128.     LOADFUNC(grLfbWriteColorSwizzle,8);
  129.     LOADFUNC(grLfbWriteColorFormat,4);
  130.     LOADFUNC(grLfbWriteRegion,32);
  131.     LOADFUNC(grLfbReadRegion,28);
  132.     LOADFUNC(grAADrawLine,8);
  133.     LOADFUNC(grAADrawPoint,4);
  134.     LOADFUNC(grAADrawPolygon,12);
  135.     LOADFUNC(grAADrawPolygonVertexList,8);
  136.     LOADFUNC(grAADrawTriangle,24);
  137.     LOADFUNC(grGlideInit,0);
  138.     LOADFUNC(grGlideShutdown,0);
  139.     LOADFUNC(grGlideGetVersion,4);
  140.     LOADFUNC(grGlideGetState,4);
  141.     LOADFUNC(grGlideSetState,4);
  142.     LOADFUNC(grGlideShamelessPlug,4);
  143.     LOADFUNC(grHints,8);
  144.     LOADFUNC(guTexAllocateMemory,60);
  145.     LOADFUNC(guTexChangeAttributes,48);
  146.     LOADFUNC(guTexCombineFunction,8);
  147.     LOADFUNC(guTexGetCurrentMipMap,4);
  148.     LOADFUNC(guTexGetMipMapInfo,4);
  149.     LOADFUNC(guTexMemQueryAvail,4);
  150.     LOADFUNC(guTexMemReset,0);
  151.     LOADFUNC(guTexDownloadMipMap,12);
  152.     LOADFUNC(guTexDownloadMipMapLevel,12);
  153.     LOADFUNC(guTexSource,4);
  154.     LOADFUNC(ConvertAndDownloadRle,64);
  155.     LOADFUNC(guAADrawTriangleWithClip,12);
  156.     LOADFUNC(guDrawTriangleWithClip,12);
  157.     LOADFUNC(guDrawPolygonVertexListWithClip,8);
  158.     LOADFUNC(guAlphaSource,4);
  159.     LOADFUNC(guColorCombineFunction,4);
  160.     LOADFUNC(guEncodeRLE16,16);
  161.     LOADFUNC(guTexCreateColorMipMap,0);
  162.     LOADFUNC(guMovieStart,0);
  163.     LOADFUNC(guMovieStop,0);
  164.     LOADFUNC(guMovieSetName,4);
  165.     LOADFUNC(guFogTableIndexToW,4);
  166.     LOADFUNC(guFogGenerateExp,8);
  167.     LOADFUNC(guFogGenerateExp2,8);
  168.     LOADFUNC(guFogGenerateLinear,12);
  169.     LOADFUNC(guEndianSwapWords,4);
  170.     LOADFUNC(guEndianSwapBytes,4);
  171.     LOADFUNC(gu3dfGetInfo,8);
  172.     LOADFUNC(gu3dfLoad,8);
  173.     return TRUE;
  174. }