First, Introduction
Many times, we write a DLL and do not want others to see our exported function names through the DLL view tool. The following steps can be implemented:
1. Define the following definition in the DEF function:
Libraryexportshidefuncname @ 1 NONAME
By adding the Noname keyword, hide the function name, so that, with Dependency Walker to view the DLL, you can only see the following results:
2. How to call the function in the DLL, called by ID, the code is as follows:
1typedefvoid(WINAPI *fphidefuncname) ();2DWORD Dwerrcode =0;3wstring str =Cprochelper::getcurrentprocesspath ();4str + = L"\\Tool\\resconfig.dll";5Hmodule hmodule =LoadLibrary (Str.c_str ());6 if(NULL! =hmodule)7 {8Fphidefuncname fp = (fphidefuncname) GetProcAddress (hmodule,(char*) 1); Get function address by ID9 //fphidefuncname fp = (fphidefuncname) GetProcAddress (hmodule, "hidefuncname");Ten if(NULL! =FP) One { A fp (); - } -Dwerrcode =GetLastError (); the}
Second, Summary:
1. dlls that are only suitable for internal use;
2. Through the function name export, but also can reduce the size of the DLL;
How to hide the name of the exported function in a DLL?