Skip to content

Commit

Permalink
Hopefully fixes the uninstaller
Browse files Browse the repository at this point in the history
  • Loading branch information
valinet committed Oct 12, 2021
1 parent c8e7097 commit 99a6d5d
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 7 deletions.
8 changes: 4 additions & 4 deletions Win11DisableRoundedCorners/Resource.rc
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,2
PRODUCTVERSION 1,0,0,2
FILEVERSION 1,0,0,3
PRODUCTVERSION 1,0,0,3
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -69,12 +69,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "VALINET Solutions SRL"
VALUE "FileDescription", "Disables or restores rounded corners in Windows 11"
VALUE "FileVersion", "1.0.0.2"
VALUE "FileVersion", "1.0.0.3"
VALUE "InternalName", "Win11DisableRoundedCorners.exe"
VALUE "LegalCopyright", "Copyright (C) 2006-2021 VALINET Solutions SRL. All rights reserved."
VALUE "OriginalFilename", "Win11Dis.exe"
VALUE "ProductName", "Win11DisableRoundedCorners"
VALUE "ProductVersion", "1.0.0.2"
VALUE "ProductVersion", "1.0.0.3"
END
END
BLOCK "VarFileInfo"
Expand Down
57 changes: 54 additions & 3 deletions Win11DisableRoundedCorners/Win11DisableRoundedCorners.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,43 @@ int main(int argc, char** argv)
);
if (bRestore)
{
/*
char szSfcscannow[MAX_PATH];
ZeroMemory(
szSfcscannow,
(MAX_PATH) * sizeof(char)
);
szSfcscannow[0] = '\"';
GetSystemDirectoryA(
szSfcscannow + sizeof(char),
MAX_PATH
);
strcat_s(
szSfcscannow,
MAX_PATH,
"\\sfc.exe\" /scannow"
);
STARTUPINFO si = {sizeof(si)};
PROCESS_INFORMATION pi;
BOOL b = CreateProcessA(
NULL,
szSfcscannow,
NULL,
NULL,
TRUE,
CREATE_UNICODE_ENVIRONMENT,
NULL,
NULL,
&si,
&pi
);
WaitForSingleObject(pi.hProcess, INFINITE);
DeleteFileA(szOriginalDWM);
printf("Operation successful.\n");
Sleep(10000);
ExitWindowsEx(EWX_REBOOT | EWX_FORCE | EWX_FORCEIFHUNG, SHTDN_REASON_FLAG_PLANNED);
exit(0);
*/
GetSystemDirectoryA(
szModifiedDWM,
MAX_PATH
Expand Down Expand Up @@ -117,7 +154,6 @@ int main(int argc, char** argv)
}
else
{

if (!CopyFileA(szDWM, szModifiedDWM, FALSE))
{
printf(
Expand Down Expand Up @@ -155,7 +191,7 @@ int main(int argc, char** argv)
return 3;
}
printf("Function address is: 0x%x.\n", addr[0]);
DeleteFile(szModifiedDWM);
DeleteFileA(szModifiedDWM);
PathRemoveFileSpecA(szModifiedDWM);
strcat_s(
szModifiedDWM,
Expand Down Expand Up @@ -196,16 +232,27 @@ int main(int argc, char** argv)
UnmapViewOfFile(lpFileBase);
CloseHandle(hFileMapping);
CloseHandle(hFile);
if (!CopyFileA(szDWM, szOriginalDWM, FALSE))
{
printf("Unable to backup system file.\n");
_getch();
return 9;
}
if (!VnTakeOwnership(szDWM))
{
printf("Unable to take ownership of system file.\n");
_getch();
return 8;
}
strcat_s(
szOriginalDWM,
MAX_PATH,
"1"
);
DeleteFileA(szOriginalDWM);
if (!MoveFileA(szDWM, szOriginalDWM))
{
printf("Unable to backup system file.\n");
printf("Unable to prepare for replacing system file.\n");
_getch();
return 9;
}
Expand Down Expand Up @@ -237,6 +284,10 @@ int main(int argc, char** argv)
{
DeleteFileA(szModifiedDWM);
}
else
{
DeleteFileA(szOriginalDWM);
}
printf("Operation successful.\n");
return 0;
}

0 comments on commit 99a6d5d

Please sign in to comment.