HANDLE Proc;
HMODULE hDLL;
hDLL = LoadLibrary(TEXT("mscoree.dll"));
if(hDLL == NULL)
cout << "No Dll with Specified Name" << endl;
else
{
cout << "DLL Handle" << hDLL << endl<<endl;
cout << "Getting the process address..." << endl;
Proc = GetProcAddress(hDLL,"GetRequestedRuntimeVersion");
if(Proc == NULL)
{
FreeLibrary(hDLL);
cout << "Process load FAILED" << endl;
}
else
{
cout << "Process address found at: " << Proc << endl << endl;
LPWSTR st;DWORD* dwlength; ;DWORD cchBuffer=MAX_PATH;
HRESULT hr=GetCORSystemDirectory(st,cchBuffer,dwlength);
if(hr!=NULL)
{
printf("%s",hr);
}
FreeLibrary(hDLL);
}
}
i did like this to get the .NET installation path but i am getting Linker Errors.
error LNK2019: unresolved external symbol _GetCORSystemDirectory@12 referenced in function _main dot.obj