ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
August 2005
----- 2025 -----
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
23 participants
669 discussions
Start a n
N
ew thread
[hbirr] 17248: If the file object is for a device, we must gather some information
by hbirr@svn.reactos.com
If the file object is for a device, we must gather some information from the object attribute (at least the OBJ_INHERIT flag). We cannot use IoCreateStreamFileObject because a handle from such a file object is never inheritable. Modified: trunk/reactos/ntoskrnl/io/file.c _____ Modified: trunk/reactos/ntoskrnl/io/file.c --- trunk/reactos/ntoskrnl/io/file.c 2005-08-09 19:11:57 UTC (rev 17247) +++ trunk/reactos/ntoskrnl/io/file.c 2005-08-09 19:12:46 UTC (rev 17248) @@ -857,6 +857,10 @@ if (NT_SUCCESS(Status)) { + OBJECT_CREATE_INFORMATION ObjectCreateInfo; + OBJECT_ATTRIBUTES tmpObjectAttributes; + UNICODE_STRING ObjectName; + Status = ObReferenceObjectByHandle(LocalHandle, DesiredAccess, NULL, @@ -873,12 +877,48 @@ ObDereferenceObject (DeviceObject); return STATUS_OBJECT_NAME_COLLISION; } + + Status = ObpCaptureObjectAttributes(ObjectAttributes, + AccessMode, + NULL, + &ObjectCreateInfo, + &ObjectName); + if (!NT_SUCCESS(Status)) + { + ObDereferenceObject (DeviceObject); + return Status; + } + + InitializeObjectAttributes(&tmpObjectAttributes, + NULL, + ObjectCreateInfo.Attributes & OBJ_INHERIT, + 0, + NULL); + ObpReleaseCapturedAttributes(&ObjectCreateInfo); + if (ObjectName.Buffer) ExFreePool(ObjectName.Buffer); + + /* FIXME: wt... */ - FileObject = IoCreateStreamFileObject(NULL, DeviceObject); + Status = ObCreateObject(KernelMode, + IoFileObjectType, + &tmpObjectAttributes, + KernelMode, + NULL, + sizeof(FILE_OBJECT), + 0, + 0, + (PVOID*)&FileObject); + + + /* Set File Object Data */ + FileObject->DeviceObject = IoGetAttachedDevice(DeviceObject); + FileObject->Vpb = FileObject->DeviceObject->Vpb; + /* HACK */ FileObject->Flags |= FO_DIRECT_DEVICE_OPEN; - DPRINT("%wZ\n", ObjectAttributes->ObjectName); + DPRINT1("%wZ\n", ObjectAttributes->ObjectName); + ObDereferenceObject (DeviceObject); }
19 years, 4 months
1
0
0
0
[mbosma] 17247: Full some additional Structs
by mbosma@svn.reactos.com
Full some additional Structs Modified: trunk/reactos/lib/ddraw/hal/ddraw.c Modified: trunk/reactos/lib/ddraw/rosdraw.h _____ Modified: trunk/reactos/lib/ddraw/hal/ddraw.c --- trunk/reactos/lib/ddraw/hal/ddraw.c 2005-08-09 17:55:47 UTC (rev 17246) +++ trunk/reactos/lib/ddraw/hal/ddraw.c 2005-08-09 19:11:57 UTC (rev 17247) @@ -41,8 +41,9 @@ return DDERR_INVALIDPARAMS; This->pD3dTextureFormats = HeapAlloc(GetProcessHeap(), 0, sizeof(DDSURFACEDESC) * This->D3dDriverData.dwNumTextureFormats); - This->pdwFourCC = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD) * This->HalInfo.ddCaps.dwNumFourCCCodes); - This->pvmList = HeapAlloc(GetProcessHeap(), 0, sizeof(VIDMEM) * This->HalInfo.vmiData.dwNumHeaps); + This->HalInfo.vmiData.pvmList = HeapAlloc(GetProcessHeap(), 0, sizeof(VIDMEM) * This->HalInfo.vmiData.dwNumHeaps); + This->DirectDrawGlobal.lpdwFourCC = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD) * This->HalInfo.ddCaps.dwNumFourCCCodes); + This->DirectDrawGlobal.lpZPixelFormats = HeapAlloc(GetProcessHeap(), 0, sizeof(DDPIXELFORMAT) * This->DirectDrawGlobal.dwNumZPixelFormats); if(!DdQueryDirectDrawObject ( &This->DirectDrawGlobal, @@ -54,9 +55,19 @@ &This->D3dDriverData, &This->DriverCallbacks.D3dBufferCallbacks, This->pD3dTextureFormats, - This->pdwFourCC, - This->pvmList )) + This->DirectDrawGlobal.lpdwFourCC, + This->HalInfo.vmiData.pvmList )) return DDERR_INVALIDPARAMS; + + This->DirectDrawGlobal.vmiData.dwDisplayWidth = This->Width; + This->DirectDrawGlobal.vmiData.dwDisplayHeight = This->Height; + This->DirectDrawGlobal.vmiData.lDisplayPitch = This->Width * This->Bpp/8; + //This->DirectDrawGlobal.vmiData.ddpfDisplay; // This has to be filled + This->DirectDrawGlobal.vmiData.dwOffscreenAlign = 64; + This->DirectDrawGlobal.vmiData.dwOverlayAlign = 64; + This->DirectDrawGlobal.vmiData.dwTextureAlign = 64; + This->DirectDrawGlobal.vmiData.dwZBufferAlign = 64; + This->DirectDrawGlobal.vmiData.dwAlphaAlign = 64; return DD_OK; } @@ -74,8 +85,8 @@ if(This->pD3dTextureFormats) HeapFree(GetProcessHeap(), 0, This->pD3dTextureFormats); - if(This->pdwFourCC) - HeapFree(GetProcessHeap(), 0, This->pdwFourCC); - if(This->pvmList) - HeapFree(GetProcessHeap(), 0, This->pvmList); + if(This->DirectDrawGlobal.lpdwFourCC) + HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpdwFourCC); + if(This->HalInfo.vmiData.pvmList) + HeapFree(GetProcessHeap(), 0, This->HalInfo.vmiData.pvmList); } _____ Modified: trunk/reactos/lib/ddraw/rosdraw.h --- trunk/reactos/lib/ddraw/rosdraw.h 2005-08-09 17:55:47 UTC (rev 17246) +++ trunk/reactos/lib/ddraw/rosdraw.h 2005-08-09 19:11:57 UTC (rev 17247) @@ -34,10 +34,7 @@ DDHALINFO HalInfo; D3DHAL_GLOBALDRIVERDATA D3dDriverData; - LPDDSURFACEDESC pD3dTextureFormats; - LPDWORD pdwFourCC; - LPVIDMEM pvmList; HWND window; DWORD cooperative_level;
19 years, 4 months
1
0
0
0
[sedwards] 17246: implemented ?name@type_info@@QBEPBDXZ.msvcr and __unDName based on code from Wine
by sedwards@svn.reactos.com
implemented ?name@type_info@@QBEPBDXZ.msvcr and __unDName based on code from Wine Modified: trunk/reactos/lib/crt/crt.xml Modified: trunk/reactos/lib/crt/include/internal/wine/msvcrt.h Modified: trunk/reactos/lib/crt/wine/cpp.c Added: trunk/reactos/lib/crt/wine/undname.c Modified: trunk/reactos/lib/msvcrt/msvcrt.def _____ Modified: trunk/reactos/lib/crt/crt.xml --- trunk/reactos/lib/crt/crt.xml 2005-08-09 16:15:52 UTC (rev 17245) +++ trunk/reactos/lib/crt/crt.xml 2005-08-09 17:55:47 UTC (rev 17246) @@ -396,5 +396,6 @@ <file>heap.c</file> <file>scanf.c</file> <file>thread.c</file> + <file>undname.c</file> </directory> </module> _____ Modified: trunk/reactos/lib/crt/include/internal/wine/msvcrt.h --- trunk/reactos/lib/crt/include/internal/wine/msvcrt.h 2005-08-09 16:15:52 UTC (rev 17245) +++ trunk/reactos/lib/crt/include/internal/wine/msvcrt.h 2005-08-09 17:55:47 UTC (rev 17246) @@ -125,4 +125,11 @@ #define _RT_CRNL 252 #define _RT_BANNER 255 +typedef void* (*malloc_func_t)(size_t); +typedef void (*free_func_t)(void*); +#define MSVCRT_malloc malloc +#define MSVCRT_free free +VOID STDCALL RtlAssert(PVOID FailedAssertion,PVOID FileName,ULONG LineNumber,PCHAR Message); +extern char* __unDName(char *,const char*,int,malloc_func_t,free_func_t,unsigned short int); + #endif /* __WINE_MSVCRT_H */ _____ Modified: trunk/reactos/lib/crt/wine/cpp.c --- trunk/reactos/lib/crt/wine/cpp.c 2005-08-09 16:15:52 UTC (rev 17245) +++ trunk/reactos/lib/crt/wine/cpp.c 2005-08-09 17:55:47 UTC (rev 17246) @@ -124,8 +124,7 @@ if (*name) { size_t name_len = strlen(*name) + 1; -// _this->name = MSVCRT_malloc(name_len); - _this->name = malloc(name_len); + _this->name = MSVCRT_malloc(name_len); memcpy(_this->name, *name, name_len); _this->do_free = TRUE; } @@ -188,8 +187,7 @@ { TRACE("(%p)\n", _this); _this->vtable = &MSVCRT_exception_vtable; -// if (_this->do_free) MSVCRT_free(_this->name); - if (_this->do_free) free(_this->name); + if (_this->do_free) MSVCRT_free(_this->name); } /****************************************************************** @@ -537,10 +535,9 @@ { TRACE("(%p)\n", _this); if (_this->name) -// MSVCRT_free(_this->name); - free(_this->name); + MSVCRT_free(_this->name); } -#if 0 /* __REACTOS__ */ + /****************************************************************** * ?name@type_info@@QBEPBDXZ (MSVCRT.@) */ @@ -550,16 +547,19 @@ if (!_this->name) { /* Create and set the demangled name */ - char* name = MSVCRT___unDName(0, _this->mangled, 0, - (MSVCRT_malloc_func)malloc, - (MSVCRT_free_func)free, 0x2800); + /* Nota: mangled name in type_info struct always start with a '.', while + * it isn't valid for mangled name. + * Is this '.' really part of the mangled name, or has it some other meaning ? + */ + char* name = __unDName(0, _this->mangled + 1, 0, + MSVCRT_malloc, MSVCRT_free, 0x2800); if (name) { unsigned int len = strlen(name); /* It seems _unDName may leave blanks at the end of the demangled name */ - if (name[len] == ' ') + while (len && name[--len] == ' ') name[len] = '\0'; _mlock(_EXIT_LOCK2); @@ -567,9 +567,8 @@ if (_this->name) { /* Another thread set this member since we checked above - use it */ -// MSVCRT_free(name); - free(name); - } + MSVCRT_free(name); + } else _this->name = name; @@ -579,7 +578,7 @@ TRACE("(%p) returning %s\n", _this, _this->name); return _this->name; } -#endif + /****************************************************************** * ?raw_name@type_info@@QBEPBDXZ (MSVCRT.@) */ _____ Added: trunk/reactos/lib/crt/wine/undname.c --- trunk/reactos/lib/crt/wine/undname.c 2005-08-09 16:15:52 UTC (rev 17245) +++ trunk/reactos/lib/crt/wine/undname.c 2005-08-09 17:55:47 UTC (rev 17246) @@ -0,0 +1,1219 @@ +/* + * Demangle VC++ symbols into C function prototypes + * + * Copyright 2000 Jon Griffiths + * 2004 Eric Pouech + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "wine/config.h" +#include "wine/port.h" + +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" +#include "winreg.h" +#include "winternl.h" +#include "wine/exception.h" +#include "winnt.h" +#include "excpt.h" +#include "wine/debug.h" +#include <malloc.h> +#include <stdlib.h> + +#include <internal/wine/msvcrt.h> +#include <internal/wine/cppexcept.h> +#include <internal/mtdll.h> + +WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); + +/* TODO: + * - document a bit (grammar + fonctions) + * - back-port this new code into tools/winedump/msmangle.c + */ + +#define UNDNAME_COMPLETE (0x0000) +#define UNDNAME_NO_LEADING_UNDERSCORES (0x0001) /* Don't show __ in calling convention */ +#define UNDNAME_NO_MS_KEYWORDS (0x0002) /* Don't show calling convention at all */ +#define UNDNAME_NO_FUNCTION_RETURNS (0x0004) /* Don't show function/method return value */ +#define UNDNAME_NO_ALLOCATION_MODEL (0x0008) +#define UNDNAME_NO_ALLOCATION_LANGUAGE (0x0010) +#define UNDNAME_NO_MS_THISTYPE (0x0020) +#define UNDNAME_NO_CV_THISTYPE (0x0040) +#define UNDNAME_NO_THISTYPE (0x0060) +#define UNDNAME_NO_ACCESS_SPECIFIERS (0x0080) /* Don't show access specifier (public/protected/private) */ +#define UNDNAME_NO_THROW_SIGNATURES (0x0100) +#define UNDNAME_NO_MEMBER_TYPE (0x0200) /* Don't show static/virtual specifier */ +#define UNDNAME_NO_RETURN_UDT_MODEL (0x0400) +#define UNDNAME_32_BIT_DECODE (0x0800) +#define UNDNAME_NAME_ONLY (0x1000) /* Only report the variable/method name */ +#define UNDNAME_NO_ARGUMENTS (0x2000) /* Don't show method arguments */ +#define UNDNAME_NO_SPECIAL_SYMS (0x4000) +#define UNDNAME_NO_COMPLEX_TYPE (0x8000) + +/* How data types modifiers are stored: + * M (in the following definitions) is defined for + * 'A', 'B', 'C' and 'D' as follows + * {<A>}: "" + * {<B>}: "const " + * {<C>}: "volatile " + * {<D>}: "const volatile " + * + * in arguments: + * P<M>x {<M>}x* + * Q<M>x {<M>}x* const + * A<M>x {<M>}x& + * in data fields: + * same as for arguments and also the following + * ?<M>x {<M>}x + * + */ + +#define MAX_ARRAY_ELTS 32 +struct array +{ + unsigned start; /* first valid reference in array */ + unsigned num; /* total number of used elts */ + unsigned max; + char* elts[MAX_ARRAY_ELTS]; +}; + +/* Structure holding a parsed symbol */ +struct parsed_symbol +{ + unsigned flags; /* the UNDNAME_ flags used for demangling */ + malloc_func_t mem_alloc_ptr; /* internal allocator */ + free_func_t mem_free_ptr; /* internal deallocator */ + + const char* current; /* pointer in input (mangled) string */ + char* result; /* demangled string */ + + struct array stack; /* stack of parsed strings */ + + void* alloc_list; /* linked list of allocated blocks */ + unsigned avail_in_first; /* number of available bytes in head block */ +}; + +/* Type for parsing mangled types */ +struct datatype_t +{ + const char* left; + const char* right; +}; + +/****************************************************************** + * und_alloc + * + * Internal allocator. Uses a simple linked list of large blocks + * where we use a poor-man allocator. It's fast, and since all + * allocation is pool, memory management is easy (esp. freeing). + */ +static void* und_alloc(struct parsed_symbol* sym, size_t len) +{ + void* ptr; + +#define BLOCK_SIZE 1024 +#define AVAIL_SIZE (1024 - sizeof(void*)) + + if (len > AVAIL_SIZE) + { + /* allocate a specific block */ + ptr = sym->mem_alloc_ptr(sizeof(void*) + len); + if (!ptr) return NULL; + *(void**)ptr = sym->alloc_list; + sym->alloc_list = ptr; + sym->avail_in_first = 0; + ptr = (char*)sym->alloc_list + sizeof(void*); + } + else + { + if (len > sym->avail_in_first) + { + /* add a new block */ + ptr = sym->mem_alloc_ptr(BLOCK_SIZE); + if (!ptr) return NULL; + *(void**)ptr = sym->alloc_list; + sym->alloc_list = ptr; + sym->avail_in_first = AVAIL_SIZE; + } + /* grab memory from head block */ + ptr = (char*)sym->alloc_list + BLOCK_SIZE - sym->avail_in_first; + sym->avail_in_first -= len; + } + return ptr; +#undef BLOCK_SIZE +#undef AVAIL_SIZE +} + +/****************************************************************** + * und_free + * Frees all the blocks in the list of large blocks allocated by + * und_alloc. + */ +static void und_free_all(struct parsed_symbol* sym) +{ + void* next; + + while (sym->alloc_list) + { + next = *(void**)sym->alloc_list; + sym->mem_free_ptr(sym->alloc_list); + sym->alloc_list = next; + } + sym->avail_in_first = 0; +} + +/****************************************************************** + * str_array_init + * Initialises an array of strings + */ +static void str_array_init(struct array* a) +{ + a->start = a->num = a->max = 0; +} + +/****************************************************************** + * str_array_push + * Adding a new string to an array + */ +static void str_array_push(struct parsed_symbol* sym, const char* ptr, size_t len, + struct array* a) +{ + assert(ptr); + assert(a); + assert(a->num < MAX_ARRAY_ELTS); + if (len == -1) len = strlen(ptr); + a->elts[a->num] = und_alloc(sym, len + 1); + assert(a->elts[a->num]); + memcpy(a->elts[a->num], ptr, len); + a->elts[a->num][len] = '\0'; + if (++a->num >= a->max) a->max = a->num; + { + int i; + char c; + + for (i = a->max - 1; i >= 0; i--) + { + c = '>'; + if (i < a->start) c = '-'; + else if (i >= a->num) c = '}'; + TRACE("\t%d%c %s\n", i, c, a->elts[i]); + } + } +} + +/****************************************************************** + * str_array_get_ref + * Extracts a reference from an existing array (doing proper type + * checking) + */ +static char* str_array_get_ref(struct array* cref, unsigned idx) +{ + assert(cref); + if (cref->start + idx >= cref->max) + { + WARN("Out of bounds: %p %d + %d >= %d\n", + cref, cref->start, idx, cref->max); + return NULL; + } + TRACE("Returning %p[%d] => %s\n", + cref, idx, cref->elts[cref->start + idx]); + return cref->elts[cref->start + idx]; +} + +/****************************************************************** + * str_printf + * Helper for printf type of command (only %s and %c are implemented) + * while dynamically allocating the buffer + */ +static char* str_printf(struct parsed_symbol* sym, const char* format, ...) +{ + va_list args; + size_t len = 1, i, sz; + char* tmp; + char* p; + char* t; + + va_start(args, format); + for (i = 0; format[i]; i++) + { + if (format[i] == '%') + { + switch (format[++i]) + { + case 's': t = va_arg(args, char*); if (t) len += strlen(t); break; + case 'c': (void)va_arg(args, int); len++; break; + default: i--; /* fall thru */ + case '%': len++; break; + } + } + else len++; + } + va_end(args); + if (!(tmp = (char*)und_alloc(sym, len))) return NULL; + va_start(args, format); + for (p = tmp, i = 0; format[i]; i++) + { + if (format[i] == '%') + { + switch (format[++i]) + { + case 's': + t = va_arg(args, char*); + if (t) + { + sz = strlen(t); + memcpy(p, t, sz); + p += sz; + } + break; + case 'c': + *p++ = (char)va_arg(args, int); + break; + default: i--; /* fall thru */ + case '%': *p++ = '%'; break; + } + } + else *p++ = format[i]; + } + va_end(args); + *p = '\0'; + return tmp; +} + +/* forward declaration */ +static BOOL demangle_datatype(struct parsed_symbol* sym, struct datatype_t* ct, + struct array* pmt, BOOL in_args); + +/****************************************************************** + * get_args + * Parses a list of function/method arguments, creates a string corresponding + * to the arguments' list. + */ +static char* get_args(struct parsed_symbol* sym, struct array* pmt_ref, BOOL z_term, + char open_char, char close_char) + +{ + struct datatype_t ct; + struct array arg_collect; + char* args_str = NULL; + int i; + + str_array_init(&arg_collect); + + /* Now come the function arguments */ + while (*sym->current) + { + /* Decode each data type and append it to the argument list */ + if (*sym->current == '@') + { + sym->current++; + break; + } + if (!demangle_datatype(sym, &ct, pmt_ref, TRUE)) + return NULL; + /* 'void' terminates an argument list */ + if (!strcmp(ct.left, "void")) + { + if (!z_term && *sym->current == '@') sym->current++; + break; + } + str_array_push(sym, str_printf(sym, "%s%s", ct.left, ct.right), -1, + &arg_collect); + if (!strcmp(ct.left, "...")) break; + } + /* Functions are always terminated by 'Z'. If we made it this far and + * don't find it, we have incorrectly identified a data type. + */ + if (z_term && *sym->current++ != 'Z') return NULL; + + if (arg_collect.num == 0 || + (arg_collect.num == 1 && !strcmp(arg_collect.elts[0], "void"))) + return str_printf(sym, "%cvoid%c", open_char, close_char); + for (i = 1; i < arg_collect.num; i++) + { + args_str = str_printf(sym, "%s,%s", args_str, arg_collect.elts[i]); + } + + if (close_char == '>' && args_str && args_str[strlen(args_str) - 1] == '>') + args_str = str_printf(sym, "%c%s%s %c", + open_char, arg_collect.elts[0], args_str, close_char); + else + args_str = str_printf(sym, "%c%s%s%c", + open_char, arg_collect.elts[0], args_str, close_char); + + return args_str; +} + +/****************************************************************** + * get_modifier + * Parses the type modifier. Always returns a static string + */ +static BOOL get_modifier(char ch, const char** ret) +{ + switch (ch) + { + case 'A': *ret = NULL; break; + case 'B': *ret = "const"; break; + case 'C': *ret = "volatile"; break; + case 'D': *ret = "const volatile"; break; + default: return FALSE; + } + return TRUE; +} + +static const char* get_modified_type(struct parsed_symbol* sym, char modif) +{ + const char* modifier; + const char* ret = NULL; + const char* str_modif; + + switch (modif) + { + case 'A': str_modif = " &"; break; + case 'P': str_modif = " *"; break; + case 'Q': str_modif = " * const"; break; + case '?': str_modif = ""; break; + default: return NULL; + } + + if (get_modifier(*sym->current++, &modifier)) + { + unsigned mark = sym->stack.num; + struct datatype_t sub_ct; + + /* Recurse to get the referred-to type */ + if (!demangle_datatype(sym, &sub_ct, NULL, FALSE)) + return NULL; + ret = str_printf(sym, "%s%s%s%s%s", + sub_ct.left, sub_ct.left && modifier ? " " : NULL, + modifier, sub_ct.right, str_modif); + sym->stack.num = mark; + } + return ret; +} + +/****************************************************************** + * get_class + * Parses class as a list of parent-classes, separated by '@', terminated by '@@' + * and stores the result in 'a' array. Each parent-classes, as well as the inner + * element (either field/method name or class name), are stored as allocated + * strings in the array. + */ +static BOOL get_class(struct parsed_symbol* sym) +{ + const char* ptr; + + while (*sym->current != '@') + { + switch (*sym->current) + { + case '\0': return FALSE; + + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + case '8': case '9': + ptr = str_array_get_ref(&sym->stack, *sym->current++ - '0'); + if (!ptr) return FALSE; + str_array_push(sym, ptr, -1, &sym->stack); + break; + case '?': + if (*++sym->current == '$') + { + const char* name = ++sym->current; + char* full = NULL; + char* args = NULL; + unsigned num_mark = sym->stack.num; + unsigned start_mark = sym->stack.start; + + while (*sym->current++ != '@'); + + sym->stack.start = sym->stack.num; + str_array_push(sym, name, sym->current - name -1, &sym->stack); + args = get_args(sym, NULL, FALSE, '<', '>'); + if (args != NULL) + { + full = str_printf(sym, "%s%s", sym->stack.elts[num_mark], args); + } + if (!full) return FALSE; + sym->stack.elts[num_mark] = full; + sym->stack.num = num_mark + 1; + sym->stack.start = start_mark; + } + break; + default: + ptr = sym->current; + while (*sym->current++ != '@'); + str_array_push(sym, ptr, sym->current - 1 - ptr, &sym->stack); + break; + } + } + sym->current++; + return TRUE; +} + +/****************************************************************** + * get_class_string + * From an array collected by get_class, constructs the corresponding (allocated) + * string + */ +static char* get_class_string(struct parsed_symbol* sym, /*const struct array* a, */int start) +{ + int i; + size_t len, sz; + char* ret; + struct array *a = &sym->stack; + for (len = 0, i = start; i < a->num; i++) + { + assert(a->elts[i]); + len += 2 + strlen(a->elts[i]); + } + if (!(ret = und_alloc(sym, len - 1))) return NULL; + for (len = 0, i = a->num - 1; i >= start; i--) + { + sz = strlen(a->elts[i]); + memcpy(ret + len, a->elts[i], sz); + len += sz; + if (i > start) + { + ret[len++] = ':'; + ret[len++] = ':'; + } + } + ret[len] = '\0'; + return ret; +} + +/****************************************************************** + * get_calling_convention + * Returns a static string corresponding to the calling convention described + * by char 'ch'. Sets export to TRUE iff the calling convention is exported. + */ +static BOOL get_calling_convention(struct parsed_symbol* sym, char ch, + const char** call_conv, const char** exported, + unsigned flags) +{ + *call_conv = *exported = NULL; + + if (!(flags & (UNDNAME_NO_MS_KEYWORDS | UNDNAME_NO_ALLOCATION_LANGUAGE))) + { + if (flags & UNDNAME_NO_LEADING_UNDERSCORES) + { + if (((ch - 'A') % 2) == 1) *exported = "dll_export "; + switch (ch) + { + case 'A': case 'B': *call_conv = "cdecl"; break; + case 'C': case 'D': *call_conv = "pascal"; break; + case 'E': case 'F': *call_conv = "thiscall"; break; + case 'G': case 'H': *call_conv = "stdcall"; break; + case 'I': case 'J': *call_conv = "fastcall"; break; + case 'K': break; + default: ERR("Unknown calling convention %c\n", ch); return FALSE; + } + } + else + { + if (((ch - 'A') % 2) == 1) *exported = "__dll_export "; + switch (ch) + { + case 'A': case 'B': *call_conv = "__cdecl"; break; + case 'C': case 'D': *call_conv = "__pascal"; break; + case 'E': case 'F': *call_conv = "__thiscall"; break; + case 'G': case 'H': *call_conv = "__stdcall"; break; + case 'I': case 'J': *call_conv = "__fastcall"; break; + case 'K': break; + default: ERR("Unknown calling convention %c\n", ch); return FALSE; + } + } + } + return TRUE; +} + +/******************************************************************* + * get_simple_type + * Return a string containing an allocated string for a simple data type + */ +static const char* get_simple_type(struct parsed_symbol* sym, char c) +{ + const char* type_string; + + switch (c) + { + case 'C': type_string = "signed char"; break; + case 'D': type_string = "char"; break; + case 'E': type_string = "unsigned char"; break; + case 'F': type_string = "short"; break; + case 'G': type_string = "unsigned short"; break; + case 'H': type_string = "int"; break; + case 'I': type_string = "unsigned int"; break; + case 'J': type_string = "long"; break; + case 'K': type_string = "unsigned long"; break; + case 'M': type_string = "float"; break; + case 'N': type_string = "double"; break; + case 'O': type_string = "long double"; break; + case 'X': type_string = "void"; break; + case 'Z': type_string = "..."; break; + default: type_string = NULL; break; + } + return type_string; +} +/******************************************************************* + * get_extented_type + * Return a string containing an allocated string for a simple data type + */ +static const char* get_extended_type(struct parsed_symbol* sym, char c) +{ + const char* type_string; + + switch (c) + { + case 'D': type_string = "__int8"; break; + case 'E': type_string = "unsigned __int8"; break; + case 'F': type_string = "__int16"; break; + case 'G': type_string = "unsigned __int16"; break; + case 'H': type_string = "__int32"; break; + case 'I': type_string = "unsigned __int32"; break; + case 'J': type_string = "__int64"; break; + case 'K': type_string = "unsigned __int64"; break; + case 'L': type_string = "__int128"; break; + case 'M': type_string = "unsigned __int128"; break; + case 'N': type_string = "bool"; break; + case 'W': type_string = "wchar_t"; break; + default: type_string = NULL; break; + } + return type_string; +} + +/******************************************************************* + * demangle_datatype + * + * Attempt to demangle a C++ data type, which may be datatype. + * a datatype type is made up of a number of simple types. e.g: + * char** = (pointer to (pointer to (char))) + */ +static BOOL demangle_datatype(struct parsed_symbol* sym, struct datatype_t* ct, + struct array* pmt_ref, BOOL in_args) +{ + char dt; + BOOL add_pmt = TRUE; + + assert(ct); + ct->left = ct->right = NULL; + + switch (dt = *sym->current++) + { + case '_': + /* MS type: __int8,__int16 etc */ + ct->left = get_extended_type(sym, *sym->current++); + break; + case 'C': case 'D': case 'E': case 'F': case 'G': + case 'H': case 'I': case 'J': case 'K': case 'M': + case 'N': case 'O': case 'X': case 'Z': + /* Simple data types */ + ct->left = get_simple_type(sym, dt); + add_pmt = FALSE; + break; + case 'T': /* union */ + case 'U': /* struct */ + case 'V': /* class */ + /* Class/struct/union */ + { + unsigned mark = sym->stack.num; + const char* struct_name = NULL; + const char* type_name = NULL; + + if (!get_class(sym) || + !(struct_name = get_class_string(sym, mark))) goto done; + sym->stack.num = mark; + if (!(sym->flags & UNDNAME_NO_COMPLEX_TYPE)) + { + switch (dt) + { + case 'T': type_name = "union "; break; + case 'U': type_name = "struct "; break; + case 'V': type_name = "class "; break; + } + } + ct->left = str_printf(sym, "%s%s", type_name, struct_name); + } + break; + case '?': + /* not all the time is seems */ + if (!(ct->left = get_modified_type(sym, '?'))) goto done; + break; + case 'A': + if (!(ct->left = get_modified_type(sym, 'A'))) goto done; + break; + case 'Q': + if (!(ct->left = get_modified_type(sym, in_args ? 'Q' : 'P'))) goto done; + break; + case 'P': /* Pointer */ + if (isdigit(*sym->current)) + { + /* FIXME: P6 = Function pointer, others who knows.. */ + if (*sym->current++ == '6') + { + char* args = NULL; + const char* call_conv; + const char* exported; + struct datatype_t sub_ct; + unsigned mark = sym->stack.num; + + if (!get_calling_convention(sym, *sym->current++, + &call_conv, &exported, + sym->flags & ~UNDNAME_NO_ALLOCATION_LANGUAGE) || + !demangle_datatype(sym, &sub_ct, pmt_ref, FALSE)) + goto done; + + args = get_args(sym, pmt_ref, TRUE, '(', ')'); + if (!args) goto done; + sym->stack.num = mark; + + ct->left = str_printf(sym, "%s%s (%s*", + sub_ct.left, sub_ct.right, call_conv); + ct->right = str_printf(sym, ")%s", args); + } + else goto done; + } + else if (!(ct->left = get_modified_type(sym, 'P'))) goto done; + break; + case 'W': + if (*sym->current == '4') + { + char* enum_name; + unsigned mark = sym->stack.num; + sym->current++; + if (!get_class(sym) || + !(enum_name = get_class_string(sym, mark))) goto done; + sym->stack.num = mark; + if (sym->flags & UNDNAME_NO_COMPLEX_TYPE) + ct->left = enum_name; + else + ct->left = str_printf(sym, "enum %s", enum_name); + } + else goto done; + break; + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + /* Referring back to previously parsed type */ + ct->left = str_array_get_ref(pmt_ref, dt - '0'); + if (!ct->left) goto done; + add_pmt = FALSE; + break; + case '$': + if (sym->current[0] != '0') goto done; + if (sym->current[1] >= '0' && sym->current[1] <= '9') + { + char* ptr; + ptr = und_alloc(sym, 2); + ptr[0] = sym->current[1] + 1; + ptr[1] = 0; + ct->left = ptr; + sym->current += 2; + } + else if ((sym->current[1] >= 'A' && sym->current[1] <= 'P') && + sym->current[2] == '@') + { + char* ptr; + ptr = und_alloc(sym, 3); + if (sym->current[1] <= 'J') + { + ptr[0] = '0' + sym->current[1] - 'A'; + ptr[1] = 0; + } + else + { + ptr[0] = '1'; + ptr[1] = sym->current[1] - 'K' + '0'; + ptr[2] = 0; + } + ct->left = ptr; + sym->current += 3; + } + else goto done; + break; + default : + ERR("Unknown type %c\n", dt); + break; + } + if (add_pmt && pmt_ref && in_args) + str_array_push(sym, str_printf(sym, "%s%s", ct->left, ct->right), + -1, pmt_ref); +done: + + return ct->left != NULL; +} + +/****************************************************************** + * handle_data + * Does the final parsing and handling for a variable or a field in + * a class. + */ +static BOOL handle_data(struct parsed_symbol* sym) +{ + const char* access = NULL; + const char* member_type = NULL; + const char* modifier = NULL; + struct datatype_t ct; + char* name = NULL; + BOOL ret = FALSE; + char dt; + + /* 0 private static + * 1 protected static + * 2 public static + * 3 private non-static + * 4 protected non-static + * 5 public non-static + * 6 ?? static + * 7 ?? static + */ + + if (!(sym->flags & UNDNAME_NO_ACCESS_SPECIFIERS)) + { + /* we only print the access for static members */ + switch (*sym->current) + { + case '0': access = "private: "; break; + case '1': access = "protected: "; break; + case '2': access = "public: "; break; + } + } + + if (!(sym->flags & UNDNAME_NO_MEMBER_TYPE)) + { + if (*sym->current >= '0' && *sym->current <= '2') + member_type = "static "; + } + + name = get_class_string(sym, 0); + + switch (dt = *sym->current++) + { + case '0': case '1': case '2': + case '3': case '4': case '5': + { + unsigned mark = sym->stack.num; + if (!demangle_datatype(sym, &ct, NULL, FALSE)) goto done; + if (!get_modifier(*sym->current++, &modifier)) goto done; + sym->stack.num = mark; + } + break; + case '6' : /* compiler generated static */ + case '7' : /* compiler generated static */ + ct.left = ct.right = NULL; + if (!get_modifier(*sym->current++, &modifier)) goto done; + if (*sym->current != '@') + { + unsigned mark = sym->stack.num; + char* cls = NULL; + + if (!get_class(sym) || + !(cls = get_class_string(sym, mark))) goto done; + sym->stack.num = mark; + ct.right = str_printf(sym, "{for `%s'}", cls); + } + break; + default: goto done; + } + if (sym->flags & UNDNAME_NAME_ONLY) ct.left = ct.right = modifier = NULL; + sym->result = str_printf(sym, "%s%s%s%s%s%s%s%s", access, + member_type, ct.left, + modifier && ct.left ? " " : NULL, modifier, + modifier || ct.left ? " " : NULL, name, ct.right); + ret = TRUE; +done: + return ret; +} + +/****************************************************************** + * handle_method + * Does the final parsing and handling for a function or a method in + * a class. + */ +static BOOL handle_method(struct parsed_symbol* sym, BOOL cast_op) +{ + const char* access = NULL; + const char* member_type = NULL; + struct datatype_t ct_ret; + const char* call_conv; + const char* modifier = NULL; + const char* exported; + const char* args_str = NULL; + const char* name = NULL; + BOOL ret = FALSE; + unsigned mark; + struct array array_pmt; + + /* FIXME: why 2 possible letters for each option? + * 'A' private: + * 'B' private: + * 'C' private: static + * 'D' private: static + * 'E' private: virtual + * 'F' private: virtual + * 'G' private: thunk + * 'H' private: thunk + * 'I' protected: + * 'J' protected: + * 'K' protected: static + * 'L' protected: static + * 'M' protected: virtual + * 'N' protected: virtual + * 'O' protected: thunk + * 'P' protected: thunk + * 'Q' public: + * 'R' public: + * 'S' public: static + * 'T' public: static + * 'U' public: virtual + * 'V' public: virtual + * 'W' public: thunk + * 'X' public: thunk [truncated at 1000 lines; 354 more skipped]
19 years, 4 months
1
0
0
0
[gdalsnes] 17245: return timer id for windowed timers also
by gdalsnes@svn.reactos.com
return timer id for windowed timers also Modified: trunk/reactos/subsys/win32k/ntuser/timer.c _____ Modified: trunk/reactos/subsys/win32k/ntuser/timer.c --- trunk/reactos/subsys/win32k/ntuser/timer.c 2005-08-09 16:13:50 UTC (rev 17244) +++ trunk/reactos/subsys/win32k/ntuser/timer.c 2005-08-09 16:15:52 UTC (rev 17245) @@ -101,7 +101,7 @@ return 0; } IntReleaseWindowObject(WindowObject); - Ret = 1; + Ret = IDEvent; } #if 1
19 years, 4 months
1
0
0
0
[hpoussin] 17244: Implement SetupDiGetSelectedDriverW/SetupDiSetSelectedDriverW
by hpoussin@svn.reactos.com
Implement SetupDiGetSelectedDriverW/SetupDiSetSelectedDriverW Define rank of a driver as in MSDN description Fix comments in Flags/FlagsEx description Factorise DeviceInfoElement structure creation in CreateDeviceInfoElement(). Modified: trunk/reactos/lib/setupapi/devinst.c Modified: trunk/reactos/lib/setupapi/setupapi.spec _____ Modified: trunk/reactos/lib/setupapi/devinst.c --- trunk/reactos/lib/setupapi/devinst.c 2005-08-09 16:08:00 UTC (rev 17243) +++ trunk/reactos/lib/setupapi/devinst.c 2005-08-09 16:13:50 UTC (rev 17244) @@ -152,6 +152,9 @@ /* If CreationFlags contains DICD_INHERIT_CLASSDRVS, this list is invalid */ /* If the driver is not searched/detected, this list is empty */ LIST_ENTRY DriverListHead; /* List of struct DriverInfoElement */ + /* Points into DriverListHead list. The pointer is NULL if no driver is + * currently chosen. */ + struct DriverInfoElement *SelectedDriver; /* List of interfaces implemented by this device */ LIST_ENTRY InterfaceHead; /* List of struct DeviceInterface */ @@ -167,13 +170,9 @@ HKEY HKLM; /* Local or distant HKEY_LOCAL_MACHINE registry key */ /* Flags is a combination of: - * - DI_FLAGSEX_DIDINFOLIST * - DI_DIDCLASS - * - DI_MULTMFGS - * Set by SetupDiBuildDriverInfoList if drivers of - * multiple manufacturers found - * - DI_FLAGSEX_DIDCOMPATINFO - * - DI_COMPAT_FROM_CLASS + * Set when the class driver list is created + * - DI_COMPAT_FROM_CLASS (FIXME: not supported) * Forces SetupDiBuildDriverInfoList to build a class drivers list * FlagsEx is a combination of: */ @@ -182,6 +181,9 @@ /* If the driver is not searched/detected, this list is empty */ LIST_ENTRY DriverListHead; /* List of struct DriverInfoElement */ + /* Points into DriverListHead list. The pointer is NULL if no driver is + * currently chosen. */ + struct DriverInfoElement *SelectedDriver; LIST_ENTRY ListHead; /* List of struct DeviceInfoElement */ }; @@ -1156,6 +1158,39 @@ return ret; } +static BOOL +CreateDeviceInfoElement( + IN LPCWSTR InstancePath, + LPCGUID pClassGuid, + OUT struct DeviceInfoElement **pDeviceInfo) +{ + struct DeviceInfoElement *deviceInfo; + + *pDeviceInfo = NULL; + + deviceInfo = HeapAlloc(GetProcessHeap(), 0, sizeof(struct DeviceInfoElement) + (wcslen(InstancePath) + 1) * sizeof(WCHAR)); + if (!deviceInfo) + { + SetLastError(ERROR_NO_SYSTEM_RESOURCES); + return FALSE; + } + wcscpy(deviceInfo->Data, InstancePath); + deviceInfo->DeviceName = deviceInfo->Data; + deviceInfo->UniqueId = wcsrchr(deviceInfo->Data, '\\'); + deviceInfo->DeviceDescription = NULL; + memcpy(&deviceInfo->ClassGuid, pClassGuid, sizeof(GUID)); + deviceInfo->CreationFlags = 0; + deviceInfo->hwndParent = NULL; + deviceInfo->Flags = 0; /* FIXME */ + deviceInfo->FlagsEx = 0; /* FIXME */ + deviceInfo->SelectedDriver = NULL; + InitializeListHead(&deviceInfo->DriverListHead); + InitializeListHead(&deviceInfo->InterfaceHead); + + *pDeviceInfo = deviceInfo; + return TRUE; +} + static LONG SETUP_CreateDevListFromEnumerator( struct DeviceInfoSet *list, LPCGUID pClassGuid OPTIONAL, @@ -1252,24 +1287,12 @@ } /* Add the entry to the list */ - deviceInfo = HeapAlloc(GetProcessHeap(), 0, sizeof(struct DeviceInfoElement) + (wcslen(InstancePath) + 1) * sizeof(WCHAR)); - if (!deviceInfo) + if (!CreateDeviceInfoElement(InstancePath, pClassGuid, &deviceInfo)) { RegCloseKey(hDeviceIdKey); - return ERROR_NO_SYSTEM_RESOURCES; + return GetLastError(); } TRACE("Adding '%S' to device info set %p\n", InstancePath, list); - wcscpy(deviceInfo->Data, InstancePath); - deviceInfo->DeviceName = deviceInfo->Data; - deviceInfo->UniqueId = &deviceInfo->Data[pEndOfInstancePath - InstancePath + 1]; - deviceInfo->DeviceDescription = NULL; - memcpy(&deviceInfo->ClassGuid, pClassGuid, sizeof(GUID)); - deviceInfo->CreationFlags = 0; - deviceInfo->hwndParent = NULL; - deviceInfo->Flags = 0; /* FIXME */ - deviceInfo->FlagsEx = 0; /* FIXME */ - InitializeListHead(&deviceInfo->DriverListHead); - InitializeListHead(&deviceInfo->InterfaceHead); InsertTailList(&list->ListHead, &deviceInfo->ListEntry); } RegCloseKey(hDeviceIdKey); @@ -2841,25 +2864,8 @@ { struct DeviceInfoElement *deviceInfo; - deviceInfo = HeapAlloc(GetProcessHeap(), 0, sizeof(struct DeviceInfoElement) + (wcslen(DeviceName) + 1) * sizeof(WCHAR)); - if (!deviceInfo) + if (CreateDeviceInfoElement(DeviceName, &GUID_NULL /* FIXME */, &deviceInfo)) { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - } - else - { - /* Fill members of the new structure */ - wcscpy(deviceInfo->Data, DeviceName); - deviceInfo->DeviceName = deviceInfo->Data; - deviceInfo->UniqueId = wcsrchr(deviceInfo->Data, '\\'); - deviceInfo->DeviceDescription = NULL; - //FIXME memcpy(&deviceInfo->ClassGuid, pClassGuid, sizeof(GUID)); - deviceInfo->CreationFlags = 0; - deviceInfo->hwndParent = hwndParent; - deviceInfo->Flags = 0; /* FIXME */ - deviceInfo->FlagsEx = 0; /* FIXME */ - InitializeListHead(&deviceInfo->DriverListHead); - InitializeListHead(&deviceInfo->InterfaceHead); InsertTailList(&list->ListHead, &deviceInfo->ListEntry); if (!DeviceInfoData) @@ -2900,8 +2906,7 @@ IN LPCWSTR ManufacturerName, FILETIME DriverDate, DWORDLONG DriverVersion, - IN DWORD Rank, - IN DWORD SubRank) + IN DWORD Rank) { struct DriverInfoElement *driverInfo; DWORD RequiredSize = 128; /* Initial buffer size */ @@ -2963,7 +2968,8 @@ return FALSE; } - TRACE("Adding driver '%S' [%S/%S]\n", DeviceDescription, InfFile, InfInstallSection); + TRACE("Adding driver '%S' [%S/%S] (Rank 0x%lx)\n", + DeviceDescription, InfFile, InfInstallSection, Rank); driverInfo->Info.DriverType = DriverType; driverInfo->Info.Reserved = (ULONG_PTR)driverInfo; @@ -3168,6 +3174,7 @@ if (Result) { LPCWSTR filename; + for (filename = (LPCWSTR)Buffer; *filename; filename += wcslen(filename) + 1) { INFCONTEXT ContextManufacturer, ContextDevice; @@ -3259,7 +3266,7 @@ ProviderName, ManufacturerName, DriverDate, DriverVersion, - 0, 0)) + 0)) { break; } @@ -3299,9 +3306,8 @@ HeapFree(GetProcessHeap(), 0, DeviceId); goto done; } - DriverRank = 0; DriverAlreadyAdded = FALSE; - for (currentId = (LPCWSTR)HardwareIDs; !DriverAlreadyAdded && *currentId; currentId += wcslen(currentId) + 1, DriverRank++) + for (DriverRank = 0, currentId = (LPCWSTR)HardwareIDs; !DriverAlreadyAdded && *currentId; currentId += wcslen(currentId) + 1, DriverRank++) { if (wcscmp(DeviceId, currentId) == 0) { @@ -3313,13 +3319,13 @@ ProviderName, ManufacturerName, DriverDate, DriverVersion, - DriverRank, i); + DriverRank + (i == 2 ? 0 : 0x1000 + i - 3)); DriverAlreadyAdded = TRUE; } } if (CompatibleIDs) { - for (currentId = (LPCWSTR)CompatibleIDs; !DriverAlreadyAdded && *currentId; currentId += wcslen(currentId) + 1, DriverRank++) + for (DriverRank = 0, currentId = (LPCWSTR)CompatibleIDs; !DriverAlreadyAdded && *currentId; currentId += wcslen(currentId) + 1, DriverRank++) { if (wcscmp(DeviceId, currentId) == 0) { @@ -3331,7 +3337,7 @@ ProviderName, ManufacturerName, DriverDate, DriverVersion, - DriverRank, i); + DriverRank + (i == 2 ? 0x2000 : 0x3000 + i - 3)); DriverAlreadyAdded = TRUE; } } @@ -3359,6 +3365,17 @@ } done: + if (ret) + { + if (DeviceInfoData) + { + struct DeviceInfoElement *deviceInfo = (struct DeviceInfoElement *)DeviceInfoData; + deviceInfo->Flags |= DI_DIDCOMPAT; + } + else + list->Flags |= DI_DIDCLASS; + } + HeapFree(GetProcessHeap(), 0, ProviderName); HeapFree(GetProcessHeap(), 0, ManufacturerName); HeapFree(GetProcessHeap(), 0, ManufacturerSection); @@ -3367,6 +3384,7 @@ if (hInf != INVALID_HANDLE_VALUE) SetupCloseInfFile(hInf); HeapFree(GetProcessHeap(), 0, Buffer); + TRACE("Returning %d\n", ret); return ret; } @@ -3522,25 +3540,11 @@ return FALSE; } - deviceInfo = HeapAlloc(GetProcessHeap(), 0, sizeof(struct DeviceInfoElement) + (wcslen(DeviceInstanceId) + 1) * sizeof(WCHAR)); - if (!deviceInfo) + if (!CreateDeviceInfoElement(DeviceInstanceId, &GUID_NULL /* FIXME */, &deviceInfo)) { RegCloseKey(hKey); - SetLastError(ERROR_NOT_ENOUGH_MEMORY); return FALSE; } - - wcscpy(deviceInfo->Data, DeviceInstanceId); - deviceInfo->DeviceName = deviceInfo->Data; - //FIXME deviceInfo->UniqueId = &deviceInfo->Data[pEndOfInstancePath - InstancePath + 1]; - deviceInfo->DeviceDescription = NULL; - //FIXME memcpy(&deviceInfo->ClassGuid, FIXME, sizeof(GUID)); - deviceInfo->CreationFlags = 0; - deviceInfo->hwndParent = hwndParent; - deviceInfo->Flags = 0; /* FIXME */ - deviceInfo->FlagsEx = 0; /* FIXME */ - InitializeListHead(&deviceInfo->DriverListHead); - InitializeListHead(&deviceInfo->InterfaceHead); InsertTailList(&list->ListHead, &deviceInfo->ListEntry); RegCloseKey(hKey); @@ -3688,3 +3692,133 @@ TRACE("Returning %d\n", ret); return ret; } + +/********************************************************************** * + * SetupDiGetSelectedDriverW (SETUPAPI.@) + */ +BOOL WINAPI +SetupDiGetSelectedDriverW( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, + OUT PSP_DRVINFO_DATA_W DriverInfoData) +{ + BOOL ret = FALSE; + + TRACE("%p %p %p\n", DeviceInfoSet, DeviceInfoData, DriverInfoData); + + if (!DeviceInfoSet || !DriverInfoData) + SetLastError(ERROR_INVALID_PARAMETER); + else if (DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE) + SetLastError(ERROR_INVALID_HANDLE); + else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC) + SetLastError(ERROR_INVALID_HANDLE); + else if (DeviceInfoData && DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA)) + SetLastError(ERROR_INVALID_USER_BUFFER); + else if (DriverInfoData->cbSize != sizeof(SP_DRVINFO_DATA_V1_W) && DriverInfoData->cbSize != sizeof(SP_DRVINFO_DATA_V2_W)) + SetLastError(ERROR_INVALID_USER_BUFFER); + else + { + struct DriverInfoElement *driverInfo; + + if (DeviceInfoData) + driverInfo = ((struct DeviceInfoElement *)DeviceInfoData->Reserved)->SelectedDriver; + else + driverInfo = ((struct DeviceInfoSet *)DeviceInfoSet)->SelectedDriver; + + if (driverInfo == NULL) + SetLastError(ERROR_NO_DRIVER_SELECTED); + else + { + memcpy( + DriverInfoData, + &driverInfo->Info, + DriverInfoData->cbSize); + ret = TRUE; + } + } + + TRACE("Returning %d\n", ret); + return ret; +} + +/********************************************************************** * + * SetupDiSetSelectedDriverW (SETUPAPI.@) + */ +BOOL WINAPI +SetupDiSetSelectedDriverW( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, + IN OUT PSP_DRVINFO_DATA_W DriverInfoData OPTIONAL) +{ + BOOL ret = FALSE; + + TRACE("%p %p %p\n", DeviceInfoSet, DeviceInfoData, DriverInfoData); + + if (!DeviceInfoSet) + SetLastError(ERROR_INVALID_PARAMETER); + else if (DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE) + SetLastError(ERROR_INVALID_HANDLE); + else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC) + SetLastError(ERROR_INVALID_HANDLE); + else if (DeviceInfoData && DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA)) + SetLastError(ERROR_INVALID_USER_BUFFER); + else if (DriverInfoData && DriverInfoData->cbSize != sizeof(SP_DRVINFO_DATA_V1_W) && DriverInfoData->cbSize != sizeof(SP_DRVINFO_DATA_V2_W)) + SetLastError(ERROR_INVALID_USER_BUFFER); + else + { + struct DriverInfoElement **pDriverInfo; + PLIST_ENTRY ListHead, ItemList; + + if (DeviceInfoData) + { + pDriverInfo = &((struct DeviceInfoElement *)DeviceInfoData->Reserved)->SelectedDriver; + ListHead = &((struct DeviceInfoElement *)DeviceInfoData->Reserved)->DriverListHead; + } + else + { + pDriverInfo = &((struct DeviceInfoSet *)DeviceInfoSet)->SelectedDriver; + ListHead = &((struct DeviceInfoSet *)DeviceInfoSet)->DriverListHead; + } + + if (!DriverInfoData) + { + *pDriverInfo = NULL; + ret = TRUE; + } + else + { + /* Search selected driver in list */ + ItemList = ListHead->Flink; + while (ItemList != ListHead) + { + if (DriverInfoData->Reserved != 0) + { + if (DriverInfoData->Reserved == (ULONG_PTR)ItemList) + break; + } + else + { + /* The caller wants to compare only DriverType, Description and ProviderName fields */ + struct DriverInfoElement *driverInfo = (struct DriverInfoElement *)ItemList; + if (driverInfo->Info.DriverType == DriverInfoData->DriverType + && wcscmp(driverInfo->Info.Description, DriverInfoData->Description) == 0 + && wcscmp(driverInfo->Info.ProviderName, DriverInfoData->ProviderName) == 0) + { + break; + } + } + } + if (ItemList == ListHead) + SetLastError(ERROR_INVALID_PARAMETER); + else + { + *pDriverInfo = (struct DriverInfoElement *)ItemList; + DriverInfoData->Reserved = (ULONG_PTR)ItemList; + ret = TRUE; + } + } + } + + TRACE("Returning %d\n", ret); + return ret; +} _____ Modified: trunk/reactos/lib/setupapi/setupapi.spec --- trunk/reactos/lib/setupapi/setupapi.spec 2005-08-09 16:08:00 UTC (rev 17243) +++ trunk/reactos/lib/setupapi/setupapi.spec 2005-08-09 16:13:50 UTC (rev 17244) @@ -290,7 +290,6 @@ @ stub SetupDiDeleteDevRegKey @ stdcall SetupDiDeleteDeviceInfo(long ptr) @ stub SetupDiDeleteDeviceInterfaceData -@ stub SetupDiDeleteDeviceRegKey @ stub SetupDiDestroyClassImageList @ stdcall SetupDiDestroyDeviceInfoList(long) @ stdcall SetupDiDestroyDriverInfoList(long ptr long) @@ -345,7 +344,7 @@ @ stub SetupDiGetINFClassW @ stub SetupDiGetSelectedDevice @ stub SetupDiGetSelectedDriverA -@ stub SetupDiGetSelectedDriverW +@ stdcall SetupDiGetSelectedDriverW(ptr ptr ptr) @ stub SetupDiGetWizardPage @ stdcall SetupDiInstallClassA(long str long ptr) @ stub SetupDiInstallClassExA @@ -379,7 +378,7 @@ @ stub SetupDiSetDriverInstallParamsW @ stub SetupDiSetSelectedDevice @ stub SetupDiSetSelectedDriverA -@ stub SetupDiSetSelectedDriverW +@ stdcall SetupDiSetSelectedDriverW(ptr ptr ptr) @ stub SetupDiUnremoveDevice @ stub SetupDuplicateDiskSpaceListA @ stub SetupDuplicateDiskSpaceListW
19 years, 4 months
1
0
0
0
[hbirr] 17243: Update KeActiveProcessors if an application processor does start.
by hbirr@svn.reactos.com
Update KeActiveProcessors if an application processor does start. Modified: trunk/reactos/ntoskrnl/ke/i386/kernel.c _____ Modified: trunk/reactos/ntoskrnl/ke/i386/kernel.c --- trunk/reactos/ntoskrnl/ke/i386/kernel.c 2005-08-09 16:01:42 UTC (rev 17242) +++ trunk/reactos/ntoskrnl/ke/i386/kernel.c 2005-08-09 16:08:00 UTC (rev 17243) @@ -66,6 +66,10 @@ { /* Get the feature flags. */ Ki386Cpuid(1, &Eax, &Ke386CpuidExMisc, &Ke386CpuidFlags2, &Pcr->PrcbData.FeatureBits); + + DPRINT ("Model: %x\n", (Eax & 0xf00) == 0xf00 ? ((Eax >> 4) & 0xf) | ((Eax >> 12) & 0xf0) : (Eax >> 4) & 0xf); + DPRINT ("Family: %x\n", (Eax & 0xf00) == 0xf00 ? ((Eax >> 8) & 0xf) + ((Eax >> 20) & 0xff) : (Eax >> 8) & 0xf); + /* Get the cache alignment, if it is available */ if (Pcr->PrcbData.FeatureBits & (1<<19)) { @@ -196,6 +200,8 @@ Pcr->Tib.ExceptionList = (PVOID)-1; KiGdtPrepareForApplicationProcessorInit(Id); + + KeActiveProcessors |= 1 << Id; } VOID @@ -309,6 +315,9 @@ KeInitExceptions (); KeInitInterrupts (); + KeActiveProcessors |= 1 << 0; + + if (KPCR->PrcbData.FeatureBits & X86_FEATURE_PGE) { ULONG Flags;
19 years, 4 months
1
0
0
0
[ea] 17242: Minor change.
by ea@svn.reactos.com
Minor change. Modified: trunk/reactos/tools/rbuild/doc/rbuild.dbk _____ Modified: trunk/reactos/tools/rbuild/doc/rbuild.dbk --- trunk/reactos/tools/rbuild/doc/rbuild.dbk 2005-08-09 15:47:14 UTC (rev 17241) +++ trunk/reactos/tools/rbuild/doc/rbuild.dbk 2005-08-09 16:01:42 UTC (rev 17242) @@ -1175,7 +1175,7 @@ <entry>.exe</entry> - <entry>_NtProcessStartup</entry> + <entry><function>_NtProcessStartup</function></entry> <entry>-</entry> @@ -1289,7 +1289,7 @@ <entry>.exe</entry> - <entry>_mainCRTStartup</entry> + <entry><function>_mainCRTStartup</function></entry> <entry>-</entry>
19 years, 4 months
1
0
0
0
[hbirr] 17241: - Don't try to close the thread handle twice.
by hbirr@svn.reactos.com
- Don't try to close the thread handle twice. - Close the process handle on exit for _P_OVERLAY. Modified: trunk/reactos/lib/crt/process/process.c _____ Modified: trunk/reactos/lib/crt/process/process.c --- trunk/reactos/lib/crt/process/process.c 2005-08-09 15:44:54 UTC (rev 17240) +++ trunk/reactos/lib/crt/process/process.c 2005-08-09 15:47:14 UTC (rev 17241) @@ -299,19 +299,17 @@ { case _P_NOWAIT: case _P_NOWAITO: - CloseHandle(ProcessInformation.hThread); return((int)ProcessInformation.hProcess); case _P_OVERLAY: + CloseHandle(ProcessInformation.hProcess); _exit(0); case _P_WAIT: WaitForSingleObject(ProcessInformation.hProcess, INFINITE); GetExitCodeProcess(ProcessInformation.hProcess, &dwExitCode); CloseHandle(ProcessInformation.hProcess); - CloseHandle(ProcessInformation.hThread); return( (int)dwExitCode); //CORRECT? case _P_DETACH: CloseHandle(ProcessInformation.hProcess); - CloseHandle(ProcessInformation.hThread); return( 0); } return( (int)ProcessInformation.hProcess);
19 years, 4 months
1
0
0
0
[hbirr] 17240: - Don't try to free the returned buffer from getenv.
by hbirr@svn.reactos.com
- Don't try to free the returned buffer from getenv. - Split the path correctly from shell command. Modified: trunk/reactos/lib/crt/process/_system.c _____ Modified: trunk/reactos/lib/crt/process/_system.c --- trunk/reactos/lib/crt/process/_system.c 2005-08-09 15:41:10 UTC (rev 17239) +++ trunk/reactos/lib/crt/process/_system.c 2005-08-09 15:44:54 UTC (rev 17240) @@ -47,15 +47,11 @@ if (szComSpec == NULL) { - szComSpec = _strdup("cmd.exe"); - if (szComSpec == NULL) - { - __set_errno(ENOMEM); - return -1; - } + szComSpec = "cmd.exe"; } - s = max(strchr(szComSpec, '\\'), strchr(szComSpec, '/')); + /* split the path from shell command */ + s = max(strrchr(szComSpec, '\\'), strrchr(szComSpec, '/')); if (s == NULL) s = szComSpec; else @@ -64,7 +60,6 @@ szCmdLine = malloc(strlen(s) + 4 + strlen(command) + 1); if (szCmdLine == NULL) { - free (szComSpec); __set_errno(ENOMEM); return -1; } @@ -81,7 +76,7 @@ memset (&StartupInfo, 0, sizeof(StartupInfo)); StartupInfo.cb = sizeof(StartupInfo); StartupInfo.lpReserved= NULL; - StartupInfo.dwFlags = 0; + StartupInfo.dwFlags = STARTF_USESHOWWINDOW; StartupInfo.wShowWindow = SW_SHOWDEFAULT; StartupInfo.lpReserved2 = NULL; StartupInfo.cbReserved2 = 0; @@ -98,13 +93,12 @@ NULL, NULL, TRUE, - 0, + CREATE_NEW_PROCESS_GROUP, NULL, NULL, &StartupInfo, &ProcessInformation); free(szCmdLine); - free(szComSpec); if (result == FALSE) {
19 years, 4 months
1
0
0
0
[hbirr] 17239: Don't use the required access rights for the object attributes.
by hbirr@svn.reactos.com
Don't use the required access rights for the object attributes. Modified: trunk/reactos/subsys/system/usetup/usetup.c _____ Modified: trunk/reactos/subsys/system/usetup/usetup.c --- trunk/reactos/subsys/system/usetup/usetup.c 2005-08-09 13:57:03 UTC (rev 17238) +++ trunk/reactos/subsys/system/usetup/usetup.c 2005-08-09 15:41:10 UTC (rev 17239) @@ -3606,8 +3606,8 @@ InitializeObjectAttributes(&ObjectAttributes, &UnicodeString, - EVENT_ALL_ACCESS, 0, + 0, NULL); Status = NtOpenEvent(&ReactOSInitEvent, EVENT_ALL_ACCESS,
19 years, 4 months
1
0
0
0
← Newer
1
...
33
34
35
36
37
38
39
...
67
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
Results per page:
10
25
50
100
200