How use this method in practic?
What i try:
#include <winsxs.h>
#include <atlbase.h>
#include <iostream>
typedef HRESULT (__stdcall *CreateAsmCache)(IAssemblyCache **ppAsmCache, DWORD dwReserved);
int main(){
CoInitialize(0);
HMODULE sxsModule = NULL;
cout << "Sxs.dll " << (sxsModule = LoadLibraryA("Sxs.dll")) << endl;
CreateAsmCache createAssemblyCache;
cout << "GetProcAddress createAssemblyCache " << (createAssemblyCache = (CreateAsmCache) GetProcAddress(sxsModule, "CreateAssemblyCache")) << endl;
IAssemblyCache *pCache = NULL;
cout << "CreateAssemblyCache:" << createAssemblyCache(&pCache, 0) << endl;
printf("pCache %p\n", pCache);
wchar_t arg[] = L"x86_microsoft.vc80.debugcrt_1fc8b3b9a1e18e3b_8.0.50727.42_none_ef74ff32550b5bf0"; //example
wprintf(L"%s uninstall result\n", arg);
ULONG ulDisposition;
HRESULT result = pCache->UninstallAssembly(0, arg, NULL, &ulDisposition);
wprintf(L"0x%08lx %ld\n", result, ulDisposition);
pCache->Release();
CoUninitialize();
return 0;
}
Output:
Sxs.dll 6BF60000
GetProcAddress createAssemblyCache 6BFAB130
CreateAssemblyCache:0
pCache 00689E28
x86_microsoft.vc80.debugcrt_1fc8b3b9a1e18e3b_8.0.50727.42_none_ef74ff32550b5bf0 uninstall result
0x00000000 0
Util must run as admin user.
Result 0, but nothing changes, nothing unistalled.
Even i set to wchar_t arg[] = L"blablabla";
nothing changes. Results is 0x00000000 0
.
P.S. InstallAssembly
for sxs is works by the way.
Tested on Windows 10 Pro x64, 1709 (16299.125)
User contributions licensed under CC BY-SA 3.0