https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d1598788cdf827ce5616d…
commit d1598788cdf827ce5616d545d2a96f6aa41e2ed1
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Sat Feb 23 13:34:28 2019 +0100
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Sat Feb 23 13:35:07 2019 +0100
[WS2_32] Use SEH in WSCGetProviderPath()
---
dll/win32/ws2_32/src/enumprot.c | 68 +++++++++++++++++++++++------------------
1 file changed, 38 insertions(+), 30 deletions(-)
diff --git a/dll/win32/ws2_32/src/enumprot.c b/dll/win32/ws2_32/src/enumprot.c
index a47b290104..be1ff596cc 100644
--- a/dll/win32/ws2_32/src/enumprot.c
+++ b/dll/win32/ws2_32/src/enumprot.c
@@ -350,52 +350,60 @@ WSCGetProviderPath(IN LPGUID lpProviderId,
/* Get the catalog */
Catalog = WsProcGetNsCatalog(Process);
- /* Setup the context */
- Context.ProviderId = *lpProviderId;
- Context.ProviderDllPath = lpszProviderDllPath;
- Context.ProviderDllPathLen = *lpProviderDllPathLen;
- Context.FoundPathLen = 0;
- Context.Found = 0;
- Context.ErrorCode = ERROR_SUCCESS;
+ _SEH2_TRY
+ {
+ /* Setup the context */
+ Context.ProviderId = *lpProviderId;
+ Context.ProviderDllPath = lpszProviderDllPath;
+ Context.ProviderDllPathLen = *lpProviderDllPathLen;
+ Context.FoundPathLen = 0;
+ Context.Found = 0;
+ Context.ErrorCode = ERROR_SUCCESS;
- ErrorCode = ERROR_SUCCESS;
+ ErrorCode = ERROR_SUCCESS;
- /* Enumerate the catalog */
- WsNcEnumerateCatalogItems(Catalog, ProviderEnumerationProc, &Context);
+ /* Enumerate the catalog */
+ WsNcEnumerateCatalogItems(Catalog, ProviderEnumerationProc, &Context);
- /* Check the error code */
- if (Context.ErrorCode == ERROR_SUCCESS)
- {
- /* Check if provider was found */
- if (Context.Found)
+ /* Check the error code */
+ if (Context.ErrorCode == ERROR_SUCCESS)
{
- PathLen = Context.FoundPathLen;
-
- /* Check whether buffer is too small
- * If it isn't, return length without null char
- * (see ProviderEnumerationProc)
- */
- if (Context.FoundPathLen <= *lpProviderDllPathLen)
+ /* Check if provider was found */
+ if (Context.Found)
{
- PathLen = Context.FoundPathLen - 1;
+ PathLen = Context.FoundPathLen;
+
+ /* Check whether buffer is too small
+ * If it isn't, return length without null char
+ * (see ProviderEnumerationProc)
+ */
+ if (Context.FoundPathLen <= *lpProviderDllPathLen)
+ {
+ PathLen = Context.FoundPathLen - 1;
+ }
+ else
+ {
+ ErrorCode = WSAEFAULT;
+ }
+
+ /* Set returned/required length */
+ *lpProviderDllPathLen = PathLen;
}
else
{
- ErrorCode = WSAEFAULT;
+ ErrorCode = WSAEINVAL;
}
-
- /* Set returned/required length */
- *lpProviderDllPathLen = PathLen;
}
else
{
- ErrorCode = WSAEINVAL;
+ ErrorCode = Context.ErrorCode;
}
}
- else
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- ErrorCode = Context.ErrorCode;
+ ErrorCode = WSAEFAULT;
}
+ _SEH2_END;
/* Do we have to return failure? */
if (ErrorCode != ERROR_SUCCESS)