windows.cfg: Enhance/fix Windows configuration (#2177)

Add/fix some missing/incorrect function configurations found by
analyzing TortoiseGit project.
Add some macros.
This commit is contained in:
Sebastian 2019-09-18 08:41:37 +02:00 committed by GitHub
parent 96171bfbc4
commit 5bf6bd1f5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 283 additions and 6 deletions

View File

@ -1284,6 +1284,7 @@
<dealloc>RtlDestroyHeap</dealloc>
</memory>
<memory>
<alloc init="true" buffer-size="strdup">strdup</alloc>
<alloc init="true">wcsdup</alloc>
<alloc init="true" buffer-size="strdup">_strdup</alloc>
<alloc init="true">_wcsdup</alloc>
@ -2301,6 +2302,30 @@ HFONT CreateFont(
</arg>
<arg nr="4"/>
</function>
<!-- char *strdup(const char *s); -->
<function name="strdup">
<noreturn>false</noreturn>
<returnValue type="char *"/>
<use-retval/>
<warn severity="style" alternatives="_strdup" reason="Obsolete">These POSIX functions are deprecated. Use the ISO C++ conformant _strdup, _wcsdup, _mbsdup instead.</warn>
<arg nr="1">
<not-null/>
<not-uninit/>
<not-bool/>
</arg>
</function>
<!-- wchar_t *wcsdup(const wchar_t *s); -->
<function name="wcsdup">
<noreturn>false</noreturn>
<returnValue type="wchar_t *"/>
<use-retval/>
<warn severity="style" alternatives="_wcsdup" reason="Obsolete">These POSIX functions are deprecated. Use the ISO C++ conformant _strdup, _wcsdup, _mbsdup instead.</warn>
<arg nr="1">
<not-null/>
<not-uninit/>
<not-bool/>
</arg>
</function>
<!-- char *_strdup(const char *strSource);
wchar_t *_wcsdup(const wchar_t *strSource);
unsigned char *_mbsdup(const unsigned char *strSource);-->
@ -3567,8 +3592,8 @@ HFONT CreateFont(
</arg>
</function>
<!-- DWORD GetFullPathNameA(LPCSTR lpFileName, DWORD nBufferLength, LPSTR lpBuffer, LPSTR *lpFilePart);-->
<!-- Argument 3 is optional (NULL is allowed if argument 2 is 0) -->
<function name="GetFullPathNameA,GetFullPathNameW,GetFullPathName">
<use-retval/>
<noreturn>false</noreturn>
<returnValue type="DWORD"/>
<leak-ignore/>
@ -3580,14 +3605,35 @@ HFONT CreateFont(
<valid>0:</valid>
</arg>
<arg nr="3" direction="out">
<not-uninit/>
<not-null/>
<minsize type="argvalue" arg="2"/>
</arg>
<arg nr="4" direction="in">
<not-uninit/>
</arg>
</function>
<!-- DWORD GetLongPathNameA(LPCSTR lpszShortPath, LPSTR lpszLongPath, DWORD cchBuffer); -->
<!-- DWORD GetLongPathNameW(LPCWSTR lpszShortPath, LPWSTR lpszLongPath, DWORD cchBuffer); -->
<!-- DWORD GetShortPathNameA(LPCSTR lpszLongPath, LPSTR lpszShortPath, DWORD cchBuffer); -->
<!-- DWORD GetShortPathNameW(LPCWSTR lpszLongPath, LPWSTR lpszShortPath, DWORD cchBuffer); -->
<!-- Argument 2 is optional (NULL is allowed if argument 3 is 0) -->
<function name="GetLongPathName,GetLongPathNameA,GetLongPathNameW,GetShortPathName,GetShortPathNameA,GetShortPathNameW">
<noreturn>false</noreturn>
<returnValue type="DWORD"/>
<leak-ignore/>
<arg nr="1" direction="in">
<not-null/>
<not-uninit/>
<strz/>
</arg>
<arg nr="2" direction="out">
<minsize type="argvalue" arg="3"/>
</arg>
<arg nr="3" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
</function>
<!-- BOOL WINAPI GetDefaultCommConfig(
_In_ LPCTSTR lpszName,
_Out_ LPCOMMCONFIG lpCC,
@ -5464,15 +5510,45 @@ HFONT CreateFont(
<not-uninit/>
</arg>
</function>
<!-- bool IsWindows10OrGreater(void) -->
<!-- https://docs.microsoft.com/en-us/windows/win32/api/versionhelpers/-->
<function name="IsWindows10OrGreater,IsWindows7OrGreater,IsWindows7SP1OrGreater,IsWindows8OrGreater,IsWindows8OrGreater,IsWindowsServer,IsWindowsVistaSP2OrGreater,IsWindowsXPSP3OrGreater,IsWindowsXPSP2OrGreater,IsWindowsXPSP1OrGreater,IsWindowsXPOrGreater,IsWindowsVersionOrGreater,IsWindowsVistaOrGreater,IsWindowsVistaSP1OrGreater">
<!-- https://docs.microsoft.com/en-us/windows/win32/api/versionhelpers/ -->
<!-- bool IsWindowsXPOrGreater(); -->
<!-- bool IsWindowsXPSP1OrGreater(); -->
<!-- bool IsWindowsXPSP2OrGreater(); -->
<!-- bool IsWindowsXPSP3OrGreater(); -->
<!-- bool IsWindowsVistaOrGreater(); -->
<!-- bool IsWindowsVistaSP1OrGreater(); -->
<!-- bool IsWindowsVistaSP2OrGreater(); -->
<!-- bool IsWindows7OrGreater(); -->
<!-- bool IsWindows7SP1OrGreater(); -->
<!-- bool IsWindows8OrGreater(); -->
<!-- bool IsWindows8Point1OrGreater(); -->
<!-- bool IsWindows10OrGreater(); -->
<!-- bool IsWindowsServer(); -->
<function name="IsWindowsXPOrGreater,IsWindowsXPSP1OrGreater,IsWindowsXPSP2OrGreater,IsWindowsXPSP3OrGreater,IsWindowsVistaOrGreater,IsWindowsVistaSP1OrGreater,IsWindowsVistaSP2OrGreater,IsWindows7OrGreater,IsWindows7SP1OrGreater,IsWindows8OrGreater,IsWindows8Point1OrGreater,IsWindows10OrGreater,IsWindowsServer">
<noreturn>false</noreturn>
<returnValue type="bool"/>
<leak-ignore/>
<use-retval/>
<pure/>
</function>
<!-- bool IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor); -->
<function name="IsWindowsVersionOrGreater">
<noreturn>false</noreturn>
<returnValue type="bool"/>
<leak-ignore/>
<use-retval/>
<pure/>
<arg nr="1" direction="in">
<not-uninit/>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
</arg>
<arg nr="3" direction="in">
<not-uninit/>
<not-bool/>
</arg>
</function>
<!--int WSAStartup(
__in WORD wVersionRequested,
__out LPWSADATA lpWSAData);-->
@ -6013,6 +6089,180 @@ HFONT CreateFont(
<not-bool/>
</arg>
</function>
<!-- int _atoi_l(const char *str, _locale_t locale); -->
<!-- int _wtoi_l(const wchar_t *str, _locale_t locale); -->
<function name="_atol_l,_wtol_l">
<noreturn>false</noreturn>
<returnValue type="int"/>
<use-retval/>
<leak-ignore/>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
<strz/>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
<not-bool/>
</arg>
</function>
<!-- int _wtoi(const wchar_t *str); -->
<function name="_wtoi">
<noreturn>false</noreturn>
<returnValue type="int"/>
<use-retval/>
<leak-ignore/>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
<strz/>
</arg>
</function>
<!-- long _atol_l(const char *str, _locale_t locale); -->
<!-- long _wtol_l(const wchar_t *str, _locale_t locale); -->
<function name="_atol_l,_wtol_l">
<noreturn>false</noreturn>
<returnValue type="long"/>
<use-retval/>
<leak-ignore/>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
<strz/>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
<not-bool/>
</arg>
</function>
<!-- long _wtol(const wchar_t *str); -->
<function name="_wtol">
<noreturn>false</noreturn>
<returnValue type="long"/>
<use-retval/>
<leak-ignore/>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
<strz/>
</arg>
</function>
<!-- wchar_t * _wgetenv(const wchar_t *varname); -->
<function name="_wgetenv">
<noreturn>false</noreturn>
<returnValue type="wchar_t *"/>
<use-retval/>
<leak-ignore/>
<arg nr="1" direction="in">
<not-null/>
<not-uninit/>
<strz/>
</arg>
</function>
<!-- NOT_BUILD_WINDOWS_DEPRECATE DWORD GetVersion(); -->
<function name="GetVersion">
<noreturn>false</noreturn>
<returnValue type="DWORD"/>
<use-retval/>
<warn severity="information">GetVersion may be altered or unavailable for releases after Windows 8.1. Instead, use the Version Helper functions</warn>
</function>
<!-- NOT_BUILD_WINDOWS_DEPRECATE BOOL GetVersionExA(LPOSVERSIONINFOA lpVersionInformation); -->
<function name="GetVersionEx">
<noreturn>false</noreturn>
<returnValue type="BOOL"/>
<leak-ignore/>
<warn severity="information">GetVersionEx may be altered or unavailable for releases after Windows 8.1. Instead, use the Version Helper functions</warn>
<arg nr="1" direction="inout">
<not-null/>
<not-bool/>
</arg>
</function>
<!-- VERSIONHELPERAPI is defined as "inline bool" in VersionHelpers.h -->
<!-- VERSIONHELPERAPI IsWindowsXPOrGreater(); -->
<!-- VERSIONHELPERAPI IsWindowsXPSP1OrGreater(); -->
<!-- VERSIONHELPERAPI IsWindowsXPSP2OrGreater(); -->
<!-- VERSIONHELPERAPI IsWindowsXPSP3OrGreater(); -->
<!-- VERSIONHELPERAPI IsWindowsVistaOrGreater(); -->
<!-- VERSIONHELPERAPI IsWindowsVistaSP1OrGreater(); -->
<!-- VERSIONHELPERAPI IsWindowsVistaSP2OrGreater(); -->
<!-- VERSIONHELPERAPI IsWindows7OrGreater(); -->
<!-- VERSIONHELPERAPI IsWindows7SP1OrGreater(); -->
<!-- VERSIONHELPERAPI IsWindows8OrGreater(); -->
<!-- VERSIONHELPERAPI IsWindows8Point1OrGreater(); -->
<!-- VERSIONHELPERAPI IsWindows10OrGreater(); -->
<!-- VERSIONHELPERAPI IsWindowsServer(); -->
<function name="IsWindowsXPOrGreater,IsWindowsXPSP1OrGreater,IsWindowsXPSP2OrGreater,IsWindowsXPSP3OrGreater,IsWindowsVistaOrGreater,IsWindowsVistaSP1OrGreater,IsWindowsVistaSP2OrGreater,IsWindows7OrGreater,IsWindows7SP1OrGreater,IsWindows8OrGreater,IsWindows8Point1OrGreater,IsWindows10OrGreater,IsWindowsServer">
<noreturn>false</noreturn>
<returnValue type="bool"/>
<use-retval/>
</function>
<!-- int _setmode (int fd, int mode); -->
<function name="_setmode">
<noreturn>false</noreturn>
<returnValue type="int"/>
<leak-ignore/>
<arg nr="1" direction="in">
<not-uninit/>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
<not-bool/>
</arg>
</function>
<!-- BOOL PathFileExistsA(LPCSTR pszPath); -->
<!-- BOOL PathFileExistsW(LPCWSTR pszPath); -->
<function name="PathFileExists,PathFileExistsA,PathFileExistsW">
<noreturn>false</noreturn>
<returnValue type="BOOL"/>
<use-retval/>
<leak-ignore/>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
<strz/>
</arg>
</function>
<!-- DWORD GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh); -->
<function name="GetFileSize">
<noreturn>false</noreturn>
<returnValue type="DWORD"/>
<leak-ignore/>
<arg nr="1" direction="in">
<not-uninit/>
</arg>
<arg nr="2" direction="out">
<not-bool/>
</arg>
</function>
<!-- BOOL GetFileSizeEx(HANDLE hFile, PLARGE_INTEGER lpFileSize); -->
<function name="GetFileSizeEx">
<noreturn>false</noreturn>
<returnValue type="BOOL"/>
<leak-ignore/>
<arg nr="1" direction="in">
<not-uninit/>
</arg>
<arg nr="2" direction="out">
<not-null/>
<not-bool/>
</arg>
</function>
<!-- errno_t gmtime_s(struct tm* tmDest, const __time_t* sourceTime); -->
<!-- errno_t _gmtime32_s(struct tm* tmDest, const __time32_t* sourceTime); -->
<!-- errno_t _gmtime64_s(struct tm* tmDest, const __time64_t* sourceTime); -->
<function name="gmtime_s,_gmtime32_s,_gmtime64_s">
<noreturn>false</noreturn>
<returnValue type="errno_t"/>
<leak-ignore/>
<arg nr="1" direction="out">
<not-null/>
</arg>
<arg nr="2" direction="in">
<not-null/>
<not-uninit/>
<not-bool/>
</arg>
</function>
<podtype name="POINTER_SIGNED" sign="s"/>
<podtype name="POINTER_UNSIGNED" sign="u"/>
<podtype name="__time32_t" sign="s" size="4"/>
@ -12257,4 +12507,13 @@ HFONT CreateFont(
<define name="COMMON_LVB_REVERSE_VIDEO" value="0x4000"/>
<define name="COMMON_LVB_UNDERSCORE" value="0x8000"/>
<define name="COMMON_LVB_SBCSDBCS" value="0x0300"/>
<!-- fileapi.h -->
<define name="CREATE_NEW" value="1"/>
<define name="CREATE_ALWAYS" value="2"/>
<define name="OPEN_EXISTING" value="3"/>
<define name="OPEN_ALWAYS" value="4"/>
<define name="TRUNCATE_EXISTING" value="5"/>
<define name="INVALID_FILE_SIZE" value="((DWORD)0xFFFFFFFF)"/>
<define name="INVALID_SET_FILE_POINTER" value="((DWORD)-1)"/>
<define name="INVALID_FILE_ATTRIBUTES" value="((DWORD)-1)"/>
</def>

View File

@ -896,6 +896,24 @@ error_t nullPointer__strncpy_s_l(char *strDest, size_t numberOfElements, const c
return _strncpy_s_l(strDest, numberOfElements, strSource, count, locale);
}
void GetShortPathName_validCode(TCHAR* lpszPath)
{
long length = GetShortPathName(lpszPath, NULL, 0);
if (length == 0) {
_tprintf(TEXT("error"));
return;
}
TCHAR* buffer = new TCHAR[length];
length = GetShortPathName(lpszPath, buffer, length);
if (length == 0) {
delete [] buffer;
_tprintf(TEXT("error"));
return;
}
_tprintf(TEXT("long name = %s short name = %s"), lpszPath, buffer);
delete [] buffer;
}
class MyClass :public CObject {
DECLARE_DYNAMIC(MyClass)
DECLARE_DYNCREATE(MyClass)