lsputil.cpp File Reference#include "instlsp.h"
Include dependency graph for lsputil.cpp:
![]() Go to the source code of this file.
Function Documentation
Definition at line 570 of file lsputil.cpp. 00575 { 00576 int Idx, i; 00577 00578 for(i=Index,Idx=1; i < Entry->ProtocolChain.ChainLen ;i++,Idx++) 00579 { 00580 Entry->ProtocolChain.ChainEntries[ Idx ] = Entry->ProtocolChain.ChainEntries[ i ]; 00581 } 00582 00583 Entry->ProtocolChain.ChainEntries[ 0 ] = DummyId; 00584 Entry->ProtocolChain.ChainLen = Entry->ProtocolChain.ChainLen - Index + 1; 00585 }
Definition at line 380 of file lsputil.cpp. 00384 { 00385 int orphanCount = 0, 00386 i, j; 00387 00388 for(i=0; i < iCatalogCount ;i++) 00389 { 00390 if ( pCatalog[ i ].ProtocolChain.ChainLen > 1 ) 00391 { 00392 for(j=0; j < iCatalogCount ;j++) 00393 { 00394 if ( i == j ) 00395 continue; 00396 if ( pCatalog[ j ].dwCatalogEntryId == pCatalog[ i ].ProtocolChain.ChainEntries[ 0 ] ) 00397 { 00398 break; 00399 } 00400 } 00401 if ( j >= iCatalogCount ) 00402 orphanCount++; 00403 } 00404 } 00405 00406 return orphanCount; 00407 }
Definition at line 501 of file lsputil.cpp. 00506 { 00507 int i; 00508 00509 for(i=0; i < CatalogCount ;i++) 00510 { 00511 if ( CatalogId == Catalog[ i ].dwCatalogEntryId ) 00512 { 00513 if ( Catalog[ i ].ProtocolChain.ChainLen == LAYERED_PROTOCOL ) 00514 return Catalog[ i ].dwCatalogEntryId; 00515 else 00516 return Catalog[ i ].ProtocolChain.ChainEntries[ 0 ]; 00517 } 00518 } 00519 00520 ASSERT( 0 ); 00521 00522 return 0; 00523 }
Definition at line 442 of file lsputil.cpp. 00447 { 00448 int i; 00449 00450 for(i=0; i < CatalogCount ;i++) 00451 { 00452 if ( 0 == memcmp( &Catalog[ i ].ProviderId, Guid, sizeof( GUID ) ) ) 00453 { 00454 return &Catalog[ i ]; 00455 } 00456 } 00457 00458 return NULL; 00459 }
Definition at line 417 of file lsputil.cpp. 00422 { 00423 int i; 00424 00425 for(i=0; i < CatalogCount ;i++) 00426 { 00427 if ( Catalog[ i ].dwCatalogEntryId == CatalogId ) 00428 return &Catalog[ i ]; 00429 } 00430 return NULL; 00431 }
Definition at line 469 of file lsputil.cpp. 00474 { 00475 WSAPROTOCOL_INFOW *match = NULL; 00476 00477 match = FindProviderByGuid( Guid, Catalog, CatalogCount ); 00478 if ( NULL != match ) 00479 { 00480 return match->dwCatalogEntryId; 00481 } 00482 00483 return 0; 00484 }
Definition at line 118 of file lsputil.cpp. 00125 { 00126 int count, 00127 err = SOCKET_ERROR, 00128 i; 00129 00130 // First count how many entries belong to this GUID 00131 count = 0; 00132 for(i=0; i < iEntryCount ;i++) 00133 { 00134 if ( 0 == memcmp( MatchGuid, &pEntries[i].ProviderId, sizeof( GUID ) ) ) 00135 count++; 00136 } 00137 00138 // Make sure the array passed in is large enough to hold the results 00139 if ( count > *iLayeredCount ) 00140 { 00141 *iLayeredCount = count; 00142 goto cleanup; 00143 } 00144 00145 // Go back and copy the matching providers into our array 00146 count = 0; 00147 for(i=0; i < iEntryCount ;i++) 00148 { 00149 if ( 0 == memcmp( MatchGuid, &pEntries[ i ].ProviderId, sizeof( GUID ) ) ) 00150 { 00151 memcpy( &pMatchLayers[ count++ ], &pEntries[ i ], sizeof( WSAPROTOCOL_INFOW ) ); 00152 } 00153 } 00154 00155 *iLayeredCount = count; 00156 00157 err = NO_ERROR; 00158 00159 cleanup: 00160 00161 return err; 00162 }
Definition at line 83 of file lsputil.cpp. 00088 { 00089 int Count, i; 00090 00091 Count = 0; 00092 for(i=0; i < iProviderCount ;i++) 00093 { 00094 if ( ( LAYERED_CHAIN == iProviderType ) && ( pProviders[ i ].ProtocolChain.ChainLen > 1 ) ) 00095 Count++; 00096 else if ( ( LAYERED_CHAIN != iProviderType) && ( pProviders[ i ].ProtocolChain.ChainLen == iProviderType ) ) 00097 Count++; 00098 } 00099 return Count; 00100 }
Definition at line 535 of file lsputil.cpp. 00540 { 00541 int i; 00542 00543 for(i=Entry->ProtocolChain.ChainLen; i > Index ;i--) 00544 { 00545 Entry->ProtocolChain.ChainEntries[ i ] = Entry->ProtocolChain.ChainEntries[ i - 1 ]; 00546 } 00547 00548 Entry->ProtocolChain.ChainEntries[ Index ] = InsertId; 00549 Entry->ProtocolChain.ChainLen++; 00550 }
Definition at line 177 of file lsputil.cpp. 00181 { 00182 if ( (memcmp(&pInfo1->ProviderId, &pInfo2->ProviderId, sizeof(GUID)) == 0) && 00183 (pInfo1->dwServiceFlags1 == pInfo2->dwServiceFlags1) && 00184 (pInfo1->dwServiceFlags2 == pInfo2->dwServiceFlags2) && 00185 (pInfo1->dwServiceFlags3 == pInfo2->dwServiceFlags3) && 00186 (pInfo1->dwServiceFlags4 == pInfo2->dwServiceFlags4) && 00187 (pInfo1->ProtocolChain.ChainLen == pInfo2->ProtocolChain.ChainLen) && 00188 (pInfo1->iVersion == pInfo2->iVersion) && 00189 (pInfo1->iAddressFamily == pInfo2->iAddressFamily) && 00190 (pInfo1->iMaxSockAddr == pInfo2->iMaxSockAddr) && 00191 (pInfo1->iMinSockAddr == pInfo2->iMinSockAddr) && 00192 (pInfo1->iSocketType == pInfo2->iSocketType) && 00193 (pInfo1->iProtocol == pInfo2->iProtocol) && 00194 (pInfo1->iProtocolMaxOffset == pInfo2->iProtocolMaxOffset) && 00195 (pInfo1->iNetworkByteOrder == pInfo2->iNetworkByteOrder) && 00196 (pInfo1->iSecurityScheme == pInfo2->iSecurityScheme) && 00197 (pInfo1->dwMessageSize == pInfo2->dwMessageSize) 00198 ) 00199 { 00200 return TRUE; 00201 } 00202 else 00203 { 00204 return FALSE; 00205 } 00206 }
Definition at line 59 of file lsputil.cpp. 00062 { 00063 int i; 00064 00065 for(i=0; i < pInfo->ProtocolChain.ChainLen ;i++) 00066 { 00067 if ( pInfo->ProtocolChain.ChainEntries[ i ] == dwId ) 00068 return TRUE; 00069 } 00070 return FALSE; 00071 }
Definition at line 270 of file lsputil.cpp. 00275 { 00276 int i; 00277 00278 for(i=0; i < iProviderCount ;i++) 00279 { 00280 if ( pProvider[ i ].dwCatalogEntryId == dwProviderId ) 00281 { 00282 return !( pProvider[ i ].dwServiceFlags1 & XP1_IFS_HANDLES ); 00283 } 00284 } 00285 00286 return FALSE; 00287 }
Definition at line 302 of file lsputil.cpp. 00303 { 00304 HMODULE hModule = NULL; 00305 HRESULT hr; 00306 char WinsockLibraryPath[ MAX_PATH+1 ], 00307 szExpandPath[ MAX_PATH+1 ]; 00308 00309 // 00310 // See if we're on a platform that supports WSCUpdateProvider. If so then 00311 // uninstalling an LSP is easy; otherwise, it is very painful if you're 00312 // removing an LSP that has other LSPs on top if it. 00313 // 00314 if ( GetSystemDirectoryA( WinsockLibraryPath, MAX_PATH+1 ) == 0 ) 00315 { 00316 hr = StringCchCopyA( szExpandPath, MAX_PATH+1, "%SYSTEMROOT%\\system32" ); 00317 if ( FAILED( hr ) ) 00318 { 00319 fprintf( stderr, "LoadUpdateProviderFunctions: StringCchCopyA failed: 0x%x\n", hr ); 00320 goto cleanup; 00321 } 00322 00323 if ( ExpandEnvironmentStringsA( WinsockLibraryPath, szExpandPath, MAX_PATH+1 ) == 0 ) 00324 { 00325 fprintf(stderr, "LoadUpdateProviderFunctions: Unable to expand environment string: %d\n", 00326 GetLastError() 00327 ); 00328 goto cleanup; 00329 } 00330 } 00331 00332 hr = StringCchCatA( WinsockLibraryPath, MAX_PATH+1, WINSOCK_DLL ); 00333 if ( FAILED( hr ) ) 00334 { 00335 fprintf( stderr, "LoadUpdateProviderFunctions: StringCchCatA failed: 0x%x\n", hr ); 00336 goto cleanup; 00337 } 00338 00339 hModule = LoadLibraryA( WinsockLibraryPath ); 00340 if (hModule == NULL) 00341 { 00342 fprintf(stderr, "LoadUpdateProviderFunctions: Unable to load %s: %d\n", 00343 WinsockLibraryPath, GetLastError() 00344 ); 00345 goto cleanup; 00346 } 00347 #ifdef _WIN64 00348 fnWscUpdateProvider = (LPWSCUPDATEPROVIDER)GetProcAddress(hModule, "WSCUpdateProvider"); 00349 00350 fnWscUpdateProvider32 = (LPWSCUPDATEPROVIDER)GetProcAddress(hModule, "WSCUpdateProvider32"); 00351 #else 00352 fnWscUpdateProvider = (LPWSCUPDATEPROVIDER)GetProcAddress(hModule, "WSCUpdateProvider"); 00353 #endif 00354 00355 return hModule; 00356 00357 cleanup: 00358 00359 if ( NULL != hModule ) 00360 { 00361 FreeLibrary( hModule ); 00362 hModule = NULL; 00363 } 00364 00365 return NULL; 00366 }
Definition at line 27 of file lsputil.cpp. 00031 { 00032 int i, 00033 j; 00034 00035 for(i=0; i < pInfo->ProtocolChain.ChainLen ;i++) 00036 { 00037 if ( pInfo->ProtocolChain.ChainEntries[ i ] == dwCatalogId ) 00038 { 00039 for(j=i; j < pInfo->ProtocolChain.ChainLen-1 ; j++) 00040 { 00041 pInfo->ProtocolChain.ChainEntries[ j ] = 00042 pInfo->ProtocolChain.ChainEntries[ j+1 ]; 00043 } 00044 pInfo->ProtocolChain.ChainLen--; 00045 return TRUE; 00046 } 00047 } 00048 return FALSE; 00049 }
Definition at line 218 of file lsputil.cpp. 00222 { 00223 HMODULE hMod = NULL; 00224 LPFN_GETLSPGUID fnGetLspGuid = NULL; 00225 int retval = SOCKET_ERROR; 00226 00227 // Load teh library 00228 hMod = LoadLibraryA( LspPath ); 00229 if ( NULL == hMod ) 00230 { 00231 fprintf( stderr, "RetrieveLspGuid: LoadLibraryA failed: %d\n", GetLastError() ); 00232 goto cleanup; 00233 } 00234 00235 // Get a pointer to the LSPs GetLspGuid function 00236 fnGetLspGuid = (LPFN_GETLSPGUID) GetProcAddress( hMod, "GetLspGuid" ); 00237 if ( NULL == fnGetLspGuid ) 00238 { 00239 fprintf( stderr, "RetrieveLspGuid: GetProcAddress failed: %d\n", GetLastError() ); 00240 goto cleanup; 00241 } 00242 00243 // Retrieve the LSPs GUID 00244 fnGetLspGuid( Guid ); 00245 00246 retval = NO_ERROR; 00247 00248 cleanup: 00249 00250 if ( NULL != hMod ) 00251 FreeLibrary( hMod ); 00252 00253 return retval; 00254 }
|