[PATCH 1/2] ole2: Fix error handling in ReadClassStg()
Nikolay Sivov
nsivov at codeweavers.com
Tue Jan 5 19:32:08 CST 2016
16 bit HRESULT codes are not compatible
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/ole2.dll16/ole2.c | 12 +++++++++---
include/wine/winerror16.h | 26 ++++++++++++++++++++++++++
2 files changed, 35 insertions(+), 3 deletions(-)
create mode 100644 include/wine/winerror16.h
diff --git a/dlls/ole2.dll16/ole2.c b/dlls/ole2.dll16/ole2.c
index 0052142..bcbf025 100644
--- a/dlls/ole2.dll16/ole2.c
+++ b/dlls/ole2.dll16/ole2.c
@@ -35,11 +35,11 @@
#include "winuser.h"
#include "wownt32.h"
#include "ole2.h"
-#include "winerror.h"
#include "wine/winbase16.h"
#include "wine/wingdi16.h"
#include "wine/winuser16.h"
+#include "wine/winerror16.h"
#include "ifs.h"
#include "wine/debug.h"
@@ -296,8 +296,14 @@ HRESULT WINAPI ReadClassStg16(SEGPTR pstg, CLSID *pclsid)
TRACE("(%x, %p)\n", pstg, pclsid);
- if(pclsid==NULL)
- return E_POINTER;
+ if (!pclsid)
+ return E_INVALIDARG16;
+
+ memset(pclsid, 0, sizeof(*pclsid));
+
+ if (!pstg)
+ return E_INVALIDARG16;
+
/*
* read a STATSTG structure (contains the clsid) from the storage
*/
diff --git a/include/wine/winerror16.h b/include/wine/winerror16.h
new file mode 100644
index 0000000..0af02de
--- /dev/null
+++ b/include/wine/winerror16.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) the Wine project
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef __WINE_WINE_WINERROR16_H
+#define __WINE_WINE_WINERROR16_H
+
+#include <winerror.h>
+
+#define E_INVALIDARG16 MAKE_SCODE(SEVERITY_ERROR, FACILITY_NULL, 3)
+
+#endif /* __WINE_WINE_WINERROR16_H */
--
2.6.4
More information about the wine-patches
mailing list