Fix a few more where we need to specify number of TCHARs rather than sizeof buffer

This commit is contained in:
Doug MacEachern committed 2007-11-15 21:48:24 +00:00
1 parent 2fd3beab06
commit f448bae54e
4 files changed
+7 -6

No files matched your search

+1 -1
View File
@@ -40,7 +40,7 @@ JNIEXPORT jstring SIGAR_JNI(win32_LocaleInfo_getAttribute)
int retval =
GetLocaleInfo(lcid,
attr,
value, sizeof(value));
value, sizeof(value) / sizeof(TCHAR));
if (retval) {
int len = lstrlen(value);
+2 -2
View File
@@ -431,8 +431,8 @@ JNIEXPORT jobjectArray SIGAR_JNI(win32_Pdh_pdhGetObjects)
JNIEXPORT jstring SIGAR_JNI(win32_Pdh_pdhLookupPerfName)
(JNIEnv *env, jclass cur, jint index)
{
TCHAR path[MAX_PATH];
DWORD len = MAX_PATH; /* len is number of TCHAR's, not sizeof(path) */
TCHAR path[MAX_PATH + 1];
DWORD len = sizeof(path) / sizeof(TCHAR); /* len is number of TCHAR's, not sizeof(path) */
PDH_STATUS status =
PdhLookupPerfNameByIndex(NULL, index, path, &len);
+3 -2
View File
@@ -57,9 +57,10 @@ JNIEXPORT jstring SIGAR_JNI(win32_RegistryKey_RegEnumKey)
{
jstring strResult;
TCHAR szBuffer[MAX_PATH + 1];
DWORD len = sizeof(szBuffer) / sizeof(TCHAR);
if(RegEnumKey((HKEY)hkey, index, szBuffer,
sizeof(szBuffer)) == ERROR_SUCCESS)
len) == ERROR_SUCCESS)
strResult = env->NewString((const jchar *)szBuffer,
lstrlen(szBuffer));
else
@@ -73,7 +74,7 @@ JNIEXPORT jstring SIGAR_JNI(win32_RegistryKey_RegEnumValueName)
{
jstring strResult;
TCHAR szValueName[MAX_PATH + 1];
DWORD cbValueName = sizeof(szValueName);
DWORD cbValueName = sizeof(szValueName) / sizeof(TCHAR);
if(RegEnumValue((HKEY)hkey, index, szValueName,
&cbValueName, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)