diff options
Diffstat (limited to '')
| -rw-r--r-- | src/libs/dutil/WixToolset.DUtil/dutil.cpp | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/src/libs/dutil/WixToolset.DUtil/dutil.cpp b/src/libs/dutil/WixToolset.DUtil/dutil.cpp index dd4fa8bf..83b53f64 100644 --- a/src/libs/dutil/WixToolset.DUtil/dutil.cpp +++ b/src/libs/dutil/WixToolset.DUtil/dutil.cpp | |||
| @@ -486,64 +486,3 @@ extern "C" void DAPI Dutil_RootFailure( | |||
| 486 | 486 | ||
| 487 | TraceError(hrError, "Root failure at %s:%d", szFile, iLine); | 487 | TraceError(hrError, "Root failure at %s:%d", szFile, iLine); |
| 488 | } | 488 | } |
| 489 | |||
| 490 | /******************************************************************* | ||
| 491 | LoadSystemLibrary - Fully qualifies the path to a module in the | ||
| 492 | Windows system directory and loads it. | ||
| 493 | |||
| 494 | Returns | ||
| 495 | E_MODNOTFOUND - The module could not be found. | ||
| 496 | * - Another error occured. | ||
| 497 | ********************************************************************/ | ||
| 498 | extern "C" HRESULT DAPI LoadSystemLibrary( | ||
| 499 | __in_z LPCWSTR wzModuleName, | ||
| 500 | __out HMODULE *phModule | ||
| 501 | ) | ||
| 502 | { | ||
| 503 | HRESULT hr = LoadSystemLibraryWithPath(wzModuleName, phModule, NULL); | ||
| 504 | return hr; | ||
| 505 | } | ||
| 506 | |||
| 507 | /******************************************************************* | ||
| 508 | LoadSystemLibraryWithPath - Fully qualifies the path to a module in | ||
| 509 | the Windows system directory and loads it | ||
| 510 | and returns the path | ||
| 511 | |||
| 512 | Returns | ||
| 513 | E_MODNOTFOUND - The module could not be found. | ||
| 514 | * - Another error occured. | ||
| 515 | ********************************************************************/ | ||
| 516 | extern "C" HRESULT DAPI LoadSystemLibraryWithPath( | ||
| 517 | __in_z LPCWSTR wzModuleName, | ||
| 518 | __out HMODULE *phModule, | ||
| 519 | __deref_out_z_opt LPWSTR* psczPath | ||
| 520 | ) | ||
| 521 | { | ||
| 522 | HRESULT hr = S_OK; | ||
| 523 | DWORD cch = 0; | ||
| 524 | WCHAR wzPath[MAX_PATH] = { }; | ||
| 525 | |||
| 526 | cch = ::GetSystemDirectoryW(wzPath, MAX_PATH); | ||
| 527 | DExitOnNullWithLastError(cch, hr, "Failed to get the Windows system directory."); | ||
| 528 | |||
| 529 | if (L'\\' != wzPath[cch - 1]) | ||
| 530 | { | ||
| 531 | hr = ::StringCchCatNW(wzPath, MAX_PATH, L"\\", 1); | ||
| 532 | DExitOnRootFailure(hr, "Failed to terminate the string with a backslash."); | ||
| 533 | } | ||
| 534 | |||
| 535 | hr = ::StringCchCatW(wzPath, MAX_PATH, wzModuleName); | ||
| 536 | DExitOnRootFailure(hr, "Failed to create the fully-qualified path to %ls.", wzModuleName); | ||
| 537 | |||
| 538 | *phModule = ::LoadLibraryW(wzPath); | ||
| 539 | DExitOnNullWithLastError(*phModule, hr, "Failed to load the library %ls.", wzModuleName); | ||
| 540 | |||
| 541 | if (psczPath) | ||
| 542 | { | ||
| 543 | hr = StrAllocString(psczPath, wzPath, MAX_PATH); | ||
| 544 | DExitOnFailure(hr, "Failed to copy the path to library."); | ||
| 545 | } | ||
| 546 | |||
| 547 | LExit: | ||
| 548 | return hr; | ||
| 549 | } | ||
