From e5727980da1ca57e435ae7097a494a562babe4ca Mon Sep 17 00:00:00 2001 From: historic_bruno Date: Wed, 27 May 2015 02:02:32 +0000 Subject: [PATCH] Adds debug output to display return code of failing SHGetFolderPathW, refs #3267 This was SVN commit r16688. --- source/lib/sysdep/os/win/wutil.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/lib/sysdep/os/win/wutil.cpp b/source/lib/sysdep/os/win/wutil.cpp index 30004bba4d..b712cef533 100644 --- a/source/lib/sysdep/os/win/wutil.cpp +++ b/source/lib/sysdep/os/win/wutil.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2012 Wildfire Games +/* Copyright (c) 2015 Wildfire Games * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -287,7 +287,11 @@ static OsPath* GetFolderPath(int csidl) HANDLE token = 0; wchar_t path[MAX_PATH]; // mandated by SHGetFolderPathW const HRESULT ret = SHGetFolderPathW(hwnd, csidl, token, 0, path); - ENSURE(SUCCEEDED(ret)); + if (!SUCCEEDED(ret)) + { + debug_printf("SHGetFolderPathW failed with HRESULT = 0x%08lx for csidl = 0x%04x\n", ret, csidl); + debug_warn("SHGetFolderPathW failed (see debug output)"); + } if(GetLastError() == ERROR_NO_TOKEN) // avoid polluting last error SetLastError(0); return new(wutil_Allocate(sizeof(OsPath))) OsPath(path);