@@ -39,24 +39,6 @@ using namespace System::Diagnostics;
39
39
// code in this Assembly when the assembly is loaded into any AppDomain.
40
40
//
41
41
42
- //
43
- // We want to call SetProcessDPIAware from user32.dll only on machines
44
- // running Vista or later OSs. We provide our own declaration (the
45
- // original is in winuser.h) here so we can specify the DllImport attribute
46
- // which allows delayed loading of the function - thereby allowing us to
47
- // run on pre-Vista OSs.
48
- //
49
-
50
- [DllImport(" user32.dll" , EntryPoint=" SetProcessDPIAware" )]
51
- WINUSERAPI
52
- BOOL
53
- WINAPI
54
- SetProcessDPIAware_Internal (
55
- VOID);
56
-
57
-
58
- #define WINNT_VISTA_VERSION 0x06
59
-
60
42
namespace MS { namespace Internal {
61
43
private ref class NativeWPFDLLLoader sealed
62
44
{
@@ -121,7 +103,6 @@ private class CModuleInitialize
121
103
// Constructor of class CModuleInitialize
122
104
__declspec (noinline) CModuleInitialize(void (*cleaningUpFunc)())
123
105
{
124
- IsProcessDpiAware ();
125
106
MS::Internal::NativeWPFDLLLoader::LoadDwrite ();
126
107
127
108
// Initialize some global arrays.
@@ -159,52 +140,6 @@ private class CModuleInitialize
159
140
{
160
141
return MS::Internal::NativeWPFDLLLoader::GetDWriteCreateFactoryFunctionPointer ();
161
142
}
162
-
163
- private :
164
-
165
- //
166
- // A private helper method to handle the DpiAwareness issue for current application.
167
- // This method is set as noinline since the MC++ compiler may otherwise inline it in a
168
- // Security Transparent method which will lead to a security violation where the transparent
169
- // method will be calling security critical code in this method.
170
- //
171
- __declspec (noinline) void IsProcessDpiAware ( )
172
- {
173
- Version ^osVersion = (Environment::OSVersion)->Version ;
174
-
175
- if (osVersion->Major < WINNT_VISTA_VERSION)
176
- {
177
- // DPIAware feature is available only in Vista and after.
178
- return ;
179
- }
180
-
181
- //
182
- // Below code is only for Vista and newer platform.
183
- //
184
- Assembly ^ assemblyApp;
185
- Type ^ disableDpiAwareType = System::Windows::Media::DisableDpiAwarenessAttribute::typeid ;
186
- bool bDisableDpiAware = false ;
187
-
188
- // By default, Application is DPIAware.
189
- assemblyApp = Assembly::GetEntryAssembly ();
190
-
191
- // Check if the Application has explicitly set DisableDpiAwareness attribute.
192
- if (assemblyApp != nullptr && Attribute::IsDefined (assemblyApp, disableDpiAwareType))
193
- {
194
- bDisableDpiAware = true ;
195
- }
196
-
197
-
198
- if (!bDisableDpiAware)
199
- {
200
- // DpiAware composition is enabled for this application.
201
- SetProcessDPIAware_Internal ( );
202
- }
203
-
204
- // Only when DisableDpiAwareness attribute is set in Application assembly,
205
- // It will ignore the SetProcessDPIAware API call.
206
- }
207
-
208
143
};
209
144
210
145
void CleanUp ();
0 commit comments