From 7e07a60d3ac2f4e20819c4d26e7cba26512cae4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Wed, 7 Jun 2006 17:30:06 +0000 Subject: [PATCH] Allocate buffer for system directory on heap instead of stack svn path=/trunk/; revision=22273 --- reactos/dll/win32/setupapi/devinst.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/reactos/dll/win32/setupapi/devinst.c b/reactos/dll/win32/setupapi/devinst.c index 15c14ad9dd4..4bc88122859 100644 --- a/reactos/dll/win32/setupapi/devinst.c +++ b/reactos/dll/win32/setupapi/devinst.c @@ -409,9 +409,6 @@ CheckSectionValid( DWORD i; BOOL ret = FALSE; - TRACE("%s %p 0x%x 0x%x\n", - debugstr_w(SectionName), PlatformInfo, ProductType, SuiteMask); - static const WCHAR ExtensionPlatformNone[] = {'.',0}; static const WCHAR ExtensionPlatformNT[] = {'.','N','T',0}; static const WCHAR ExtensionPlatformWindows[] = {'.','W','i','n',0}; @@ -424,6 +421,9 @@ CheckSectionValid( static const WCHAR ExtensionArchitectureppc[] = {'p','p','c',0}; static const WCHAR ExtensionArchitecturex86[] = {'x','8','6',0}; + TRACE("%s %p 0x%x 0x%x\n", + debugstr_w(SectionName), PlatformInfo, ProductType, SuiteMask); + *ScorePlatform = *ScoreMajorVersion = *ScoreMinorVersion = *ScoreProductType = *ScoreSuiteMask = 0; Section = DuplicateString(SectionName); @@ -3198,12 +3198,20 @@ InfIsFromOEMLocation( } else { - WCHAR Windir[MAX_PATH + 1 + strlenW(InfDirectory)]; + LPWSTR Windir; UINT ret; + Windir = MyMalloc((MAX_PATH + 1 + strlenW(InfDirectory)) * sizeof(WCHAR)); + if (!Windir) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + ret = GetSystemWindowsDirectoryW(Windir, MAX_PATH); if (ret == 0 || ret > MAX_PATH) { + MyFree(Windir); SetLastError(ERROR_GEN_FAILURE); return FALSE; } @@ -3221,6 +3229,7 @@ InfIsFromOEMLocation( /* The file is in another place */ *IsOEMLocation = TRUE; } + MyFree(Windir); } return TRUE; }