Advertisement
Guest User

Double LoadLibrary

a guest
Feb 16th, 2014
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2. #include <Windows.h>
  3.  
  4. using namespace std;
  5.  
  6. void load_dll(const char* s) {
  7.     HMODULE dll = LoadLibrary(s);
  8.     if (dll == NULL) {
  9.         std::cout << "Cannot load dll: " << s << "\n";
  10.         exit(1);
  11.     }
  12.     char actualDllPath[255];
  13.     GetModuleFileName(dll, actualDllPath, 255);
  14.     std::cout << "dll loaded: " << actualDllPath << "\n";
  15. }
  16.  
  17. int main() {
  18.     load_dll("dir\\a.dll");
  19.     load_dll("a.dll");
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement