#include "stdafx.h"
#include <windows.h>
#include <tchar.h>
typedef HRESULT(*DllReg)(void);
int _tmain(int argc, _TCHAR* argv[])
{
DWORD err = 0;
LPCWSTR dll = argv[1];
HMODULE module = LoadLibrary(dll);
if (module == NULL) {
err = GetLastError();
}
else {
DllReg dllReg = (DllReg)GetProcAddress(module, "DllRegisterServer");
if (dllReg == NULL) {
err = GetLastError();
}
else {
dllReg();
}
}
if (err) {
LPWSTR msg;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, 0, err, 0, (LPWSTR)&msg, 0, NULL);
wprintf(msg);
LocalFree(msg);
}
return err;
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.