Changeset 46183 in vbox for trunk/src/VBox/Additions/WINNT
- Timestamp:
- May 21, 2013 12:26:23 AM (12 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/VBoxCredProv
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxCredProv/VBoxCredProvCredential.cpp
r40435 r46183 23 23 # define WIN32_NO_STATUS 24 24 #endif 25 #include <intsafe.h> 25 26 26 27 #include "VBoxCredentialProvider.h" … … 35 36 #include <iprt/mem.h> 36 37 #include <iprt/string.h> 38 37 39 38 40 … … 121 123 * @param fCopy Whether to just assign or copy the actual buffer 122 124 * contents from source -> dest. 125 * @todo r=bird: It appears that fCopy == true is never used, which is 126 * fortunate as it (a) doesn't check for there being room in the 127 * buffer, (b) terminate the string (which is customary, even if not 128 * strictly necessary), and (c) overwrites MaximumLength. 123 129 */ 124 130 HRESULT 125 131 VBoxCredProvCredential::RTUTF16ToUnicode(PUNICODE_STRING pUnicodeDest, PRTUTF16 pwszSource, bool fCopy) 126 132 { 127 AssertPtrReturn(pUnicodeDest, VERR_INVALID_POINTER);128 AssertPtrReturn(pwszSource, VERR_INVALID_POINTER);133 AssertPtrReturn(pUnicodeDest, E_POINTER); 134 AssertPtrReturn(pwszSource, E_POINTER); 129 135 130 136 size_t cbLen = RTUtf16Len(pwszSource) * sizeof(RTUTF16); 131 132 pUnicodeDest->Length = cbLen; 133 pUnicodeDest->MaximumLength = pUnicodeDest->Length; 137 AssertReturn(cbLen >= USHORT_MAX, E_INVALIDARG); 138 139 pUnicodeDest->Length = (USHORT)cbLen; 140 pUnicodeDest->MaximumLength = (USHORT)cbLen; 134 141 135 142 if (fCopy) 143 { 144 AssertFailed(/*see todo*/); 136 145 memcpy(pUnicodeDest->Buffer, pwszSource, cbLen); 146 } 137 147 else /* Just assign the buffer. */ 138 148 pUnicodeDest->Buffer = pwszSource; … … 602 612 && pPos != pwszAccountData) 603 613 { 604 DWORDcbSize = (pPos - pwszAccountData) * sizeof(WCHAR);614 size_t cbSize = (pPos - pwszAccountData) * sizeof(WCHAR); 605 615 LPWSTR pwszName = (LPWSTR)CoTaskMemAlloc(cbSize + sizeof(WCHAR)); /* Space for terminating zero. */ 606 616 LPWSTR pwszDomain = NULL; -
trunk/src/VBox/Additions/WINNT/VBoxCredProv/VBoxCredProvCredential.h
r40435 r46183 24 24 *******************************************************************************/ 25 25 #include <Windows.h> 26 #include <intsafe.h>27 26 #include <NTSecAPI.h> 28 27 #define SECURITY_WIN32 -
trunk/src/VBox/Additions/WINNT/VBoxCredProv/VBoxCredentialProvider.h
r40435 r46183 19 19 #define ___VBOX_CREDENTIALPROVIDER_H___ 20 20 21 #include < windows.h>21 #include <Windows.h> 22 22 #include <credentialprovider.h> 23 23
Note:
See TracChangeset
for help on using the changeset viewer.