From 3d01e3722a6f1dc5d6abd2e605f3ad2a197abae2 Mon Sep 17 00:00:00 2001 From: Alnoor Allidina Date: Wed, 14 Jun 2023 22:06:15 -0400 Subject: [PATCH] Installation on 64-bit machines has never worked. Fix a couple of things: - Make sure we always have a 32-bit and a 64-bit path. Loading a 64-bit DLL into a 32-bit process just doesn't work. - Make sure we pass in the correct path in the correct spot. --- .../netds/winsock/lsp/install/instlsp.cpp | 18 +++++++++++++++++- .../netds/winsock/lsp/install/lspadd.cpp | 6 +++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Samples/Win7Samples/netds/winsock/lsp/install/instlsp.cpp b/Samples/Win7Samples/netds/winsock/lsp/install/instlsp.cpp index a74c2a6d..c7549fb4 100644 --- a/Samples/Win7Samples/netds/winsock/lsp/install/instlsp.cpp +++ b/Samples/Win7Samples/netds/winsock/lsp/install/instlsp.cpp @@ -237,7 +237,7 @@ int _cdecl main(int argc, char *argv[]) case 'd': // Full path and filename to LSP if ( i+1 >= argc ) goto cleanup; - if (_strnicmp(argv[i], "-d32", 4)) + if (!_strnicmp(argv[i], "-d32", 4)) lpszLspPathAndFile32 = argv[ ++i ]; else lpszLspPathAndFile = argv[ ++i ]; @@ -341,6 +341,22 @@ int _cdecl main(int argc, char *argv[]) goto cleanup; } + printf("lpszLspPathAndFile = %hs\n", lpszLspPathAndFile); + printf("lpszLspPathAndFile32 = %hs\n", lpszLspPathAndFile32); + +#ifdef _WIN64 + if (lpszLspPathAndFile && lpszLspPathAndFile32) + { + eCatalog = LspCatalogBoth; + } + else + { + fprintf( stderr, "\n\nError! Please specify both 64-bit and 32-bit paths of LSP!\n\n"); + bArgsOkay = FALSE; + goto cleanup; + } +#endif + if ( TRUE == bInstallOverAll ) { // Make sure user didn't specify '-a' and '-o' flags diff --git a/Samples/Win7Samples/netds/winsock/lsp/install/lspadd.cpp b/Samples/Win7Samples/netds/winsock/lsp/install/lspadd.cpp index ad33aa14..78dc4548 100644 --- a/Samples/Win7Samples/netds/winsock/lsp/install/lspadd.cpp +++ b/Samples/Win7Samples/netds/winsock/lsp/install/lspadd.cpp @@ -1322,7 +1322,7 @@ InstallProviderVista( #ifdef _WIN64 if ( ( eCatalog == LspCatalog32Only ) || ( eCatalog == LspCatalog64Only ) ) { - fprintf(stderr, "New install API always installs into both catalogs!\n"); + fprintf(stderr, "New install API always installs into both catalogs - -d and -d32 flags are required!\n"); goto cleanup; } else @@ -1365,7 +1365,7 @@ InstallProviderVista( providerGuid, lpszLspPathAndFile, #ifdef _WIN64 - (lpszLspPathAndFile32[0] == '\0' ? lpszLspPathAndFile : lpszLspPathAndFile32), + lpszLspPathAndFile32, #endif lpszLspName, ( IfsProvider ? XP1_IFS_HANDLES : 0 ), @@ -1422,7 +1422,7 @@ InstallProviderVista( providerGuid, lpszLspPathAndFile, #ifdef _WIN64 - lpszLspPathAndFile, + lpszLspPathAndFile32, #endif lpszLspName, ( IfsProvider ? XP1_IFS_HANDLES : 0 ),