Reputation: 2404
I am using the GameuxInstallHelper.dll to register my game at installation with Games Explorer.
But for some the reason the dll remains in my application folder after uninstall, but only on Win XP. On Win 7 and Vista all files are deleted.
The code used:
function CheckXPOs(): Boolean;
begin
if GetWindowsVersion shr 24 < 6 then Result:=TRUE
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
mres : integer;
begin
if CurUninstallStep = usUninstall then
begin
#ifdef AddToGameExplorer
if not CheckXPOs then
begin
RetrieveGUIDForApplication(ExpandConstant('{app}'+GE_resource), GUID);
RemoveFromGameExplorer(GUID);
RemoveTasks(GUID);
UnloadDll(ExpandConstant('{app}\GameuxInstallHelper.dll'));
end;
#endif
end;
case CurUninstallStep of
usPostUninstall:
begin
mres := MsgBox(ExpandConstant('{cm:removemsg}'), mbConfirmation, MB_YESNO)
if mres = IDYES then
DelTree(ExpandConstant('{app}'), True, True, True);
end;
end;
end;
Any idea why the dll is not deleted on XP OS's and how can i delete it? I've tried the DeleteFile function after unloading the dll, i've also tried to make another function to search for that specific dll, but nothing helped me solve the problem. And the dll is not in use, because manually the OS is letting me delete it.
Upvotes: 0
Views: 1570
Reputation: 421
You should unload dll after the "not CheckXPOs" block.
if not CheckXPOs then
begin
RetrieveGUIDForApplication(ExpandConstant('{app}'+GE_resource), GUID);
RemoveFromGameExplorer(GUID);
RemoveTasks(GUID);
end;
UnloadDll(ExpandConstant('{app}\GameuxInstallHelper.dll'));
Another way is adding "delayload"
option in declaration of all functions loaded from GameuxInstallHelper.dll
Upvotes: 1