Skip to content

Commit 5054fa3

Browse files
authored
Remove obsolete GetVersion(Ex) platform check and fix build deprecation warnings (mhammond#2589)
1 parent 0507672 commit 5054fa3

File tree

5 files changed

+6
-46
lines changed

5 files changed

+6
-46
lines changed

Pythonwin/Win32uiHostGlue.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,7 @@ inline Win32uiHostGlue::Win32uiHostGlue()
9191
}
9292
inline Win32uiHostGlue::~Win32uiHostGlue() {}
9393

94-
inline HKEY Win32uiHostGlue::GetRegistryRootKey()
95-
{
96-
// different for win32s.
97-
OSVERSIONINFO ver;
98-
ver.dwOSVersionInfoSize = sizeof(ver);
99-
GetVersionEx(&ver);
100-
return ver.dwPlatformId == VER_PLATFORM_WIN32s ? HKEY_CLASSES_ROOT : HKEY_LOCAL_MACHINE;
101-
}
94+
inline HKEY Win32uiHostGlue::GetRegistryRootKey() { return HKEY_LOCAL_MACHINE; }
10295

10396
#ifndef LINK_WITH_WIN32UI
10497

Pythonwin/pythonwin.cpp

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -109,27 +109,7 @@ BOOL CPythonWinApp::OnIdle(LONG lCount)
109109
return glue.OnIdle(lCount);
110110
}
111111

112-
CDocument *CPythonWinApp::OpenDocumentFile(LPCTSTR lpszFileName)
113-
{
114-
#if 0 // win32s no longer supported
115-
ver.dwOSVersionInfoSize = sizeof(ver);
116-
GetVersionEx(&ver);
117-
ver.dwOSVersionInfoSize = sizeof(ver);
118-
GetVersionEx(&ver);
119-
if (ver.dwPlatformId == VER_PLATFORM_WIN32s) {
120-
OutputDebugString("Win32s - Searching templates!\n");
121-
POSITION posTempl = m_pDocManager->GetFirstDocTemplatePosition();
122-
CDocTemplate* pTemplate = m_pDocManager->GetNextDocTemplate(posTempl);
123-
if (pTemplate)
124-
return pTemplate->OpenDocumentFile(lpszFileName);
125-
else {
126-
AfxMessageBox("win32s error - There is no template to use");
127-
return NULL;
128-
}
129-
} else
130-
#endif
131-
return CWinApp::OpenDocumentFile(lpszFileName);
132-
}
112+
CDocument *CPythonWinApp::OpenDocumentFile(LPCTSTR lpszFileName) { return CWinApp::OpenDocumentFile(lpszFileName); }
133113

134114
int CPythonWinApp::Run()
135115
{

Pythonwin/pywin/framework/app.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,10 @@ def InitInstance(self):
128128
HookInput()
129129
numMRU = win32ui.GetProfileVal("Settings", "Recent File List Size", 10)
130130
win32ui.LoadStdProfileSettings(numMRU)
131-
# self._obj_.InitMDIInstance()
132-
if win32api.GetVersionEx()[0] < 4:
133-
win32ui.SetDialogBkColor()
134-
win32ui.Enable3dControls()
131+
# self._obj_.InitMDIInstance()
135132

136133
# install a "callback caller" - a manager for the callbacks
137-
# self.oldCallbackCaller = win32ui.InstallCallbackCaller(self.CallbackManager)
134+
# self.oldCallbackCaller = win32ui.InstallCallbackCaller(self.CallbackManager)
138135
self.LoadMainFrame()
139136
self.SetApplicationPaths()
140137

win32/Demos/eventLogDemo.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,6 @@ def usage():
7272

7373

7474
def test():
75-
# check if running on Windows NT, if not, display notice and terminate
76-
if win32api.GetVersion() & 0x80000000:
77-
print("This sample only runs on NT")
78-
return
79-
8075
import getopt
8176
import sys
8277

win32/src/PerfMon/perfmondata.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,8 @@ DWORD APIENTRY OpenPerformanceData(LPWSTR lpDeviceNames)
150150
TCHAR registryKeyName[MAX_PATH];
151151
TCHAR szFileMapping[MAX_PATH + 10] = _T("");
152152

153-
// Use a TerminalServices friendly "Global\\" prefix if supported.
154-
OSVERSIONINFO info;
155-
info.dwOSVersionInfoSize = sizeof(info);
156-
GetVersionEx(&info);
157-
if (info.dwMajorVersion > 4)
158-
// 2000 or later - "Global\\" prefix OK.
159-
_tcscpy(szFileMapping, _T("Global\\"));
153+
// Use a TerminalServices friendly "Global\\" prefix.
154+
_tcscpy(szFileMapping, _T("Global\\"));
160155
_tcscat(szFileMapping, szModuleName);
161156

162157
//

0 commit comments

Comments
 (0)