+static
+DWORD
+ScmEncryptPassword(
+ _In_ PCWSTR pClearTextPassword,
+ _Out_ PBYTE *pEncryptedPassword,
+ _Out_ PDWORD pEncryptedPasswordSize)
+{
+ DWORD dwSize;
+ PBYTE pBuffer;
+
+ dwSize = (wcslen(pClearTextPassword) + 1) * sizeof(WCHAR);
+
+ pBuffer = HeapAlloc(GetProcessHeap(), 0, dwSize);
+ if (pBuffer == NULL)
+ return ERROR_OUTOFMEMORY;
+
+ CopyMemory(pBuffer,
+ pClearTextPassword,
+ dwSize);
+
+ *pEncryptedPassword = pBuffer;
+ *pEncryptedPasswordSize = dwSize;
+
+ return ERROR_SUCCESS;
+}
+
+