mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 20:36:26 +00:00
[SDBINST] Restore file attributes before deleting
This commit is contained in:
parent
c4181f534c
commit
20c98b3144
1 changed files with 10 additions and 7 deletions
|
@ -579,7 +579,7 @@ SdbUninstall(
|
||||||
if (pdb == NULL)
|
if (pdb == NULL)
|
||||||
{
|
{
|
||||||
wprintf(L"Can't open database %ls\n", sdbPath);
|
wprintf(L"Can't open database %ls\n", sdbPath);
|
||||||
goto end;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
tagDb = SdbFindFirstTag(pdb, TAGID_ROOT, TAG_DATABASE);
|
tagDb = SdbFindFirstTag(pdb, TAGID_ROOT, TAG_DATABASE);
|
||||||
|
@ -590,7 +590,7 @@ SdbUninstall(
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
if (!GetSdbGuid(pdb, tagDb, &dbGuid))
|
if (!GetSdbGuid(pdb, tagDb, &dbGuid))
|
||||||
{
|
{
|
||||||
wprintf(L"GetSdbGuid error\n");
|
wprintf(L"GetSdbGuid error\n");
|
||||||
goto end;
|
goto end;
|
||||||
|
@ -620,29 +620,32 @@ SdbUninstall(
|
||||||
}
|
}
|
||||||
|
|
||||||
SdbCloseDatabase(pdb);
|
SdbCloseDatabase(pdb);
|
||||||
|
pdb = NULL;
|
||||||
|
|
||||||
hres = DeleteUninstallKey(sdbName);
|
hres = DeleteUninstallKey(sdbName);
|
||||||
if (FAILED(hres))
|
if (FAILED(hres))
|
||||||
{
|
{
|
||||||
wprintf(L"Remove uninstall key fail\n");
|
wprintf(L"Remove uninstall key fail\n");
|
||||||
//goto end;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SdbUnregisterDatabase(&dbGuid))
|
if (!SdbUnregisterDatabase(&dbGuid))
|
||||||
{
|
{
|
||||||
wprintf(L"SdbUnregisterDatabase\n");
|
wprintf(L"SdbUnregisterDatabase\n");
|
||||||
goto end;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DeleteFile(sdbPath))
|
SetFileAttributesW(sdbPath, FILE_ATTRIBUTE_NORMAL);
|
||||||
|
if (!DeleteFileW(sdbPath))
|
||||||
{
|
{
|
||||||
wprintf(L"Remove file fail 0x%08X\n", GetLastError());
|
wprintf(L"Remove file fail 0x%08X\n", GetLastError());
|
||||||
goto end;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = TRUE;
|
res = TRUE;
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
if (pdb)
|
||||||
|
SdbCloseDatabase(pdb);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -871,7 +874,7 @@ int _tmain(int argc, LPWSTR argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
nameSdbStr = argv[i];
|
nameSdbStr = argv[i];
|
||||||
wprintf(L"guidSdbStr %ls\n", nameSdbStr);
|
wprintf(L"nameSdbStr %ls\n", nameSdbStr);
|
||||||
|
|
||||||
isUninstByName = TRUE;
|
isUninstByName = TRUE;
|
||||||
isInstall = FALSE;
|
isInstall = FALSE;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue