@@ -147,19 +147,32 @@ private class SnprintfImpl extends Snprintf {
147
147
148
148
/**
149
149
* The Microsoft `StringCchPrintf` function and variants.
150
+ * See: https://learn.microsoft.com/en-us/windows/win32/api/strsafe/
151
+ * and
152
+ * https://learn.microsoft.com/en-us/previous-versions/windows/embedded/ms860435(v=msdn.10)
150
153
*/
151
154
private class StringCchPrintf extends FormattingFunction {
152
155
StringCchPrintf ( ) {
153
156
this instanceof TopLevelFunction and
154
- this .hasGlobalName ( [
155
- "StringCchPrintf" , "StringCchPrintfEx" , "StringCchPrintf_l" , "StringCchPrintf_lEx" ,
156
- "StringCbPrintf" , "StringCbPrintfEx" , "StringCbPrintf_l" , "StringCbPrintf_lEx"
157
- ] ) and
157
+ exists ( string baseName |
158
+ baseName in [
159
+ "StringCchPrintf" , //StringCchPrintf(pszDest, cchDest, pszFormat, ...)
160
+ "StringCchPrintfEx" , //StringCchPrintfEx(pszDest,cchDest, ppszDestEnd, pcchRemaining, dwFlags, pszFormat, ...)
161
+ "StringCchPrintf_l" , //StringCchPrintf_l(pszDest, cbDest, pszFormat, locale, ...)
162
+ "StringCchPrintf_lEx" , //StringCchPrintf_lEx(pszDest, cchDest, ppszDestEnd, pcchRemaining, dwFlags, pszFormat, locale, ...)
163
+ "StringCbPrintf" , //StringCbPrintf(pszDest, cbDest, pszFormat, ...)
164
+ "StringCbPrintfEx" , //StringCbPrintfEx(pszDest, cbDest, ppszDestEnd, pcbRemaining, dwFlags, pszFormat, ...)
165
+ "StringCbPrintf_l" , //StringCbPrintf_l(pszDest, cbDest, pszFormat, locale, ...)
166
+ "StringCbPrintf_lEx" //StringCbPrintf_lEx(pszDest, cbDest, ppszDestEnd, pcbRemaining, dwFlags, pszFormat, locale, ...)
167
+ ]
168
+ |
169
+ this .hasGlobalName ( baseName + [ "" , "A" , "W" ] )
170
+ ) and
158
171
not exists ( this .getDefinition ( ) .getFile ( ) .getRelativePath ( ) )
159
172
}
160
173
161
174
override int getFormatParameterIndex ( ) {
162
- if this .getName ( ) .matches ( "%Ex" ) then result = 5 else result = 2
175
+ if this .getName ( ) .matches ( "%Ex" + [ "" , "A" , "W" ] ) then result = 5 else result = 2
163
176
}
164
177
165
178
override int getOutputParameterIndex ( boolean isStream ) { result = 0 and isStream = false }
0 commit comments