Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does patch.d require administrator privileges?

I'm running DMD32 D Compiler v2.071.1, on Windows 8.1 (latest update as of 09/19/2016).

When I compile a D file that contains "patch" in the file name, the resulting executable asks for admin privileges. Why?


If I name my file foo.d, everything is fine:

C:\Users\sorbet\Desktop> echo int main(string[] argv) { return 0; } > foo.d
C:\Users\sorbet\Desktop> dmd foo.d
C:\Users\sorbet\Desktop> foo.exe
C:\Users\sorbet\Desktop> echo %ERRORLEVEL%
0

But if I name it patch.d, suddenly I need admin privileges:

C:\Users\sorbet\Desktop> echo int main(string[] argv) { return 0; } > patch.d
C:\Users\sorbet\Desktop> dmd patch.d
C:\Users\sorbet\Desktop> patch.exe

UAC

Huh?


This also happens if I name it something that contains "patch" in the filename, like foopatch.d. Why is this happening, and can I disable it?

like image 837
sorbet Avatar asked Oct 23 '25 18:10

sorbet


1 Answers

This is not related to D Language, or DMD. It is a 'feature' in Windows. Windows checks if the filename of the executable to execute is/has setup.exe or *-setup, or installer.exe or *-installer in it. The same applies for patch. Windows assumes that since programs like setups/installers/patches usually require administrative privileges, it asks the user (you) for administrative privileges.

TL;DR: Windows assumes that a program needs administrative privileges if the name has setup, installer, patch, etc.. Just change the filename, it'll be fixed.

like image 121
Nafees Avatar answered Oct 27 '25 00:10

Nafees