Utilisation de chaînes Unicode LSA
Plusieurs fonctions de stratégie LSA utilisent la structure LSA_UNICODE_STRING pour stocker des informations de chaîne. Cette structure stocke la chaîne et ses informations de longueur.
Le code suivant implémente une fonction qui convertit les données LPWSTR en structures LSA_UNICODE_STRING :
#include <windows.h>
bool InitLsaString(
PLSA_UNICODE_STRING pLsaString,
LPCWSTR pwszString
)
{
DWORD dwLen = 0;
if (NULL == pLsaString)
return FALSE;
if (NULL != pwszString)
{
dwLen = wcslen(pwszString);
if (dwLen > 0x7ffe) // String is too large
return FALSE;
}
// Store the string.
pLsaString->Buffer = (WCHAR *)pwszString;
pLsaString->Length = (USHORT)dwLen * sizeof(WCHAR);
pLsaString->MaximumLength= (USHORT)(dwLen+1) * sizeof(WCHAR);
return TRUE;
}
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour