home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / mweb / MWEB Utils / ws295sdk.exe / Ws2sdkzp.exe / SAMPLES / VENDINST / VSETUP.C < prev    next >
Encoding:
C/C++ Source or Header  |  1997-06-06  |  3.6 KB  |  156 lines

  1. #include <windows.h>
  2. #include <winsock2.h>
  3.  
  4.  
  5. //
  6. // WS2SETUP_DONT_INSTALL_COMPONENT : do not under any circumstances install
  7. //      the microsoft version of this component
  8. //
  9. // WS2SETUP_INSTALL_COMPONENT : install the microsoft version of this
  10. //      component if & only if a competing vendor's version of this
  11. //      product is not installed
  12. //
  13. // WS2SETUP_UPGRADE_COMPONENT : upgrade the microsoft version of this
  14. //      component if & only if it is already installed (no error otherwise)
  15. //
  16.  
  17. #define WS2SETUP_DONT_INSTALL_COMPONENT 0
  18. #define WS2SETUP_INSTALL_COMPONENT      1
  19. #define WS2SETUP_UPGRADE_COMPONENT      2
  20.  
  21. typedef struct _VENDOR_WS2SETUP_OPTIONS     // Defaults:
  22. {
  23.     DWORD   dwSize;                         // sizeof (VENDOR_WS2SETUP_OPTIONS)
  24.  
  25.     DWORD   dwInstallMicrosoftTCP;          // WS2SETUP_INSTALL_COMPONENT
  26.  
  27.     DWORD   dwInstallMicrosoftIPX;          // WS2SETUP_UPGRADE_COMPONENT
  28.  
  29.     BOOL    bShowWS2SetupUI;                // TRUE
  30.  
  31.     DWORD   dwInstallMicrosoftDNS;          // WS2SETUP_INSTALL_COMPONENT
  32.  
  33.     DWORD   dwInstallMicrosoftSAP;          // WS2SETUP_DONT_INSTALL_COMPONENT
  34.  
  35.     LPCSTR  lpszWSock32DllLegalCopyright;   // NULL
  36.  
  37. } VENDOR_WS2SETUP_OPTIONS, FAR *LPVENDOR_WS2SETUP_OPTIONS;
  38.  
  39.  
  40. HINSTANCE   ghDLL;
  41.  
  42.  
  43. BOOL
  44. WINAPI
  45. DllMain(
  46.     HINSTANCE   hDLL,
  47.     DWORD       dwReason,
  48.     LPVOID      lpReserved
  49.     )
  50. {
  51.     switch (dwReason)
  52.     {
  53.     case DLL_PROCESS_ATTACH:
  54.  
  55.         ghDLL = hDLL;
  56.  
  57.     case DLL_PROCESS_DETACH:
  58.  
  59.         break;
  60.  
  61.     }
  62.  
  63.     return TRUE;
  64. }
  65.  
  66.  
  67. VOID
  68. WSAAPI
  69. VendorGetSetupOptions(
  70.     LPVENDOR_WS2SETUP_OPTIONS pOptions
  71.     )
  72. {
  73.     //
  74.     // Munge the options per your requirements
  75.     //
  76.     // If you are wanting Winsock2 setup to install over your
  77.     // existing Winsock installation (your private WSOCK32.DLL)
  78.     // then set pOptions->lpszWSock32DllLegalCopyright to point
  79.     // to a static string containing your version Copyright
  80.     // string.
  81.     //
  82.     // NOTE: A valid copyright string consists of one or more
  83.     //       NULL-terminated ascii strings, terminated by
  84.     //       two NULL characters, i.e. : "string1\0string2\0\0"
  85.     //
  86.  
  87.     char buf[140];
  88.  
  89.     wsprintf (buf, "pOptions=x%x", pOptions);
  90.     MessageBox (NULL, buf, "VendorGetSetupOptions: enter",MB_OK);
  91.     return;
  92. }
  93.  
  94.  
  95. LONG
  96. WSAAPI
  97. VendorInstallProvider(
  98.     int (WSAAPI *pfnWSCDeinstallProvider)(),
  99.     int (WSAAPI *pfnWSCEnumProtocols)(),
  100.     int (WSAAPI *pfnWSCGetProviderPath)(),
  101.     int (WSAAPI *pfnWSCInstallProvider)()
  102.     )
  103. {
  104.     char buf[140];
  105.  
  106.     wsprintf(
  107.         buf,
  108.         "pfnDeinst=x%x, pfnEnum=x%x, pfnGetPath=x%x, pfnInst=x%x",
  109.         pfnWSCDeinstallProvider,
  110.         pfnWSCEnumProtocols,
  111.         pfnWSCGetProviderPath,
  112.         pfnWSCInstallProvider
  113.         );
  114.  
  115.     MessageBox (NULL, buf, "VendorInstallProvider: enter",MB_OK);
  116.     return 0;  // return the # providers installed
  117. }
  118.  
  119.  
  120. LONG
  121. WSAAPI
  122. VendorInstallNameSpace(
  123.     int (WSAAPI *pfnWSCEnableNSProvider)(),
  124.     int (WSAAPI *pfnWSCInstallNameSpace)(),
  125.     int (WSAAPI *pfnWSCUnInstallNameSpace)()
  126.     )
  127. {
  128.     char buf[140];
  129.  
  130.     wsprintf(
  131.         buf,
  132.         "pfnEnable=x%x, pfnInst=x%x, pfnUnInst=x%x",
  133.         pfnWSCEnableNSProvider,
  134.         pfnWSCInstallNameSpace,
  135.         pfnWSCUnInstallNameSpace
  136.         );
  137.  
  138.     MessageBox (NULL, buf, "VendorInstallProvider: enter",MB_OK);
  139.     return 0;  // return the # name spaces installed
  140. }
  141.  
  142.  
  143. VOID
  144. WSAAPI
  145. VendorCompleteWS2Install(
  146.     LONG lResult
  147.     )
  148. {
  149.     char buf[64];
  150.  
  151.     wsprintf (buf, "lResult=x%x", lResult);
  152.     MessageBox (NULL, buf, "VendorCompleteWS2Install: enter", MB_OK);
  153.     return;
  154. }
  155. 
  156.