diff --git a/include/WinStd/Win.h b/include/WinStd/Win.h index dede6b74..eb17eba3 100644 --- a/include/WinStd/Win.h +++ b/include/WinStd/Win.h @@ -158,7 +158,7 @@ template inline VOID GuidToStringW(_In_ L /// \param[in ] lpszGuid String with GUID /// \param[out] lpGuid GUID to store the result to /// -BOOL WINSTD_API StringToGuidA(_In_z_ LPCSTR lpszGuid, _Out_ LPGUID lpGuid); +BOOL WINSTD_API StringToGuidA(_In_z_ LPCSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_ LPCSTR *lpszGuidEnd = NULL); /// /// Parses string with GUID and stores it to GUID @@ -166,7 +166,7 @@ BOOL WINSTD_API StringToGuidA(_In_z_ LPCSTR lpszGuid, _Out_ LPGUID lpGuid); /// \param[in ] lpszGuid String with GUID /// \param[out] lpGuid GUID to store the result to /// -BOOL WINSTD_API StringToGuidW(_In_z_ LPCWSTR lpszGuid, _Out_ LPGUID lpGuid); +BOOL WINSTD_API StringToGuidW(_In_z_ LPCWSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_ LPCWSTR *lpszGuidEnd = NULL); #ifdef _UNICODE #define StringToGuid StringToGuidW diff --git a/src/Win.cpp b/src/Win.cpp index 3a051c43..58709a72 100644 --- a/src/Win.cpp +++ b/src/Win.cpp @@ -25,7 +25,7 @@ // StringToGuidA ////////////////////////////////////////////////////////////////////// -BOOL WINSTD_API StringToGuidA(_In_z_ LPCSTR lpszGuid, _Out_ LPGUID lpGuid) +BOOL WINSTD_API StringToGuidA(_In_z_ LPCSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_ LPCSTR *lpszGuidEnd) { GUID g; LPSTR lpszEnd; @@ -80,14 +80,15 @@ BOOL WINSTD_API StringToGuidA(_In_z_ LPCSTR lpszGuid, _Out_ LPGUID lpGuid) if (*lpszGuid != '}') return FALSE; lpszGuid++; - if (*lpszGuid != 0) return FALSE; + if (lpszGuidEnd) + *lpszGuidEnd = lpszGuid; *lpGuid = g; return TRUE; } -BOOL WINSTD_API StringToGuidW(_In_z_ LPCWSTR lpszGuid, _Out_ LPGUID lpGuid) +BOOL WINSTD_API StringToGuidW(_In_z_ LPCWSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_ LPCWSTR *lpszGuidEnd) { GUID g; LPWSTR lpszEnd; @@ -142,7 +143,8 @@ BOOL WINSTD_API StringToGuidW(_In_z_ LPCWSTR lpszGuid, _Out_ LPGUID lpGuid) if (*lpszGuid != '}') return FALSE; lpszGuid++; - if (*lpszGuid != 0) return FALSE; + if (lpszGuidEnd) + *lpszGuidEnd = lpszGuid; *lpGuid = g; return TRUE;