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
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
July 2008
----- 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
25 participants
761 discussions
Start a n
N
ew thread
[silverblade] 34349: Sound device I/O completion abstraction. thread.c now handles the overlapped I/O structure allocations etc. and gathers completed I/O requests, tagging them with contextual information within the I/O completion APC. Once the APC returns, the completed I/O requests are passed to a callback routine. This allows wavethread.c to just supply "request" and "I/O completion" callbacks. The I/O completion callback's context data is then cast to WAVEHDR...
by silverblade@svn.reactos.org
Author: silverblade Date: Sun Jul 6 18:12:29 2008 New Revision: 34349 URL:
http://svn.reactos.org/svn/reactos?rev=34349&view=rev
Log: Sound device I/O completion abstraction. thread.c now handles the overlapped I/O structure allocations etc. and gathers completed I/O requests, tagging them with contextual information within the I/O completion APC. Once the APC returns, the completed I/O requests are passed to a callback routine. This allows wavethread.c to just supply "request" and "I/O completion" callbacks. The I/O completion callback's context data is then cast to WAVEHDR... Modified: branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h branches/silverblade-audio/lib/drivers/sound/mmebuddy/thread.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wavethread.c Modified: branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/include/react…
============================================================================== --- branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h [iso-8859-1] (original) +++ branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h [iso-8859-1] Sun Jul 6 18:12:29 2008 @@ -101,23 +101,49 @@ MMRESULT Result; } THREAD_REQUEST, *PTHREAD_REQUEST; +typedef struct _SOUND_THREAD_COMPLETED_IO +{ + struct _SOUND_THREAD_COMPLETED_IO* Next; + PVOID ContextData; /* eg: PWAVEHDR */ + DWORD BytesTransferred; +} SOUND_THREAD_COMPLETED_IO, *PSOUND_THREAD_COMPLETED_IO; + +typedef struct _SOUND_THREAD_OVERLAPPED +{ + OVERLAPPED General; + struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance; + PVOID ContextData; /* eg: PWAVEHDR */ + PSOUND_THREAD_COMPLETED_IO CompletionData; +} SOUND_THREAD_OVERLAPPED, *PSOUND_THREAD_OVERLAPPED; + typedef MMRESULT (*SOUND_THREAD_REQUEST_HANDLER)( IN struct _SOUND_DEVICE_INSTANCE* Instance, IN PVOID PrivateThreadData, IN DWORD RequestId, IN PVOID Data); +typedef VOID (*SOUND_THREAD_IO_COMPLETION_HANDLER)( + IN struct _SOUND_DEVICE_INSTANCE* Instance, + IN PVOID ContextData, + IN DWORD BytesTransferred); + typedef struct _SOUND_THREAD { /* Thread management */ HANDLE Handle; PVOID PrivateData; BOOLEAN Running; - SOUND_THREAD_REQUEST_HANDLER RequestHandler; + HANDLE ReadyEvent; /* Thread waiting for a request */ HANDLE RequestEvent; /* Caller sending a request */ HANDLE DoneEvent; /* Thread completed a request */ + + SOUND_THREAD_REQUEST_HANDLER RequestHandler; THREAD_REQUEST Request; + + SOUND_THREAD_OVERLAPPED Overlapped; + PSOUND_THREAD_COMPLETED_IO FirstCompletedIo; + SOUND_THREAD_IO_COMPLETION_HANDLER IoCompletionHandler; } SOUND_THREAD, *PSOUND_THREAD; @@ -142,6 +168,8 @@ PWAVEHDR CurrentBuffer; PWAVEHDR FirstBuffer; PWAVEHDR LastBuffer; + + /*DWORD RemainingBytes;*/ } WAVE_THREAD_DATA, *PWAVE_THREAD_DATA; /* @@ -476,7 +504,8 @@ StartSoundThread( IN PSOUND_DEVICE_INSTANCE Instance, IN SOUND_THREAD_REQUEST_HANDLER RequestHandler, - IN PVOID Data); + IN SOUND_THREAD_IO_COMPLETION_HANDLER IoCompletionHandler, + IN LPVOID PrivateThreadData); MMRESULT StopSoundThread( @@ -492,6 +521,19 @@ GetSoundThreadPrivateData( IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, OUT PVOID* PrivateData); + +VOID CALLBACK +CompleteSoundThreadIo( + IN DWORD dwErrorCode, + IN DWORD dwNumberOfBytesTransferred, + IN LPOVERLAPPED lpOverlapped); + +MMRESULT +OverlappedWriteToSoundDevice( + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, + IN PVOID ContextData, + IN PVOID Buffer, + IN DWORD BufferSize); Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/thread.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/thread.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/thread.c [iso-8859-1] Sun Jul 6 18:12:29 2008 @@ -11,6 +11,7 @@ History: 4 July 2008 - Created 5 July 2008 - Implemented basic request processing + 6 July 2008 - Added I/O completion handling */ /* @@ -24,21 +25,24 @@ #include <mmebuddy.h> +/* + This is the sound thread's processing loop. Its job is to aid in + asynchronous streaming of sound data with a kernel-mode driver. It's + basically a loop in which we wait for a request from the client, or + completed data from the kernel-mode driver. + + When either of these events occur, the relevant details get passed on + to one of the routines specified when the thread was started. +*/ DWORD WINAPI SoundThreadProc( IN LPVOID lpParameter) { PSOUND_DEVICE_INSTANCE Instance; PSOUND_THREAD Thread; - /*HANDLE Events[2];*/ Instance = (PSOUND_DEVICE_INSTANCE) lpParameter; Thread = Instance->Thread; - -/* - Events[0] = Thread->KillEvent; - Events[1] = Thread->RequestEvent; -*/ Thread->Running = TRUE; @@ -76,7 +80,29 @@ else if ( WaitResult == WAIT_IO_COMPLETION ) { /* This gets called after I/O completion */ - /* Do we need to do anything special here? */ + PSOUND_THREAD_COMPLETED_IO CompletionData; + SOUND_ASSERT(Thread->FirstCompletedIo); + + SOUND_DEBUG(L"Outside I/O completion APC"); + + /* + Purge the completed data queue + FIXME? This will be done in the WRONG ORDER! + Is this such a problem? The caller won't care. We'll need + to remove them from our queue though! + */ + while ( (CompletionData = Thread->FirstCompletedIo) ) + { + /* Call high-level custom I/O completion routine */ + Thread->IoCompletionHandler(Instance, + CompletionData->ContextData, + CompletionData->BytesTransferred); + + /* TODO: I'm sure I've forgotten something ... */ + + Thread->FirstCompletedIo = CompletionData->Next; + FreeMemory(CompletionData); + } } } @@ -141,6 +167,7 @@ StartSoundThread( IN PSOUND_DEVICE_INSTANCE Instance, IN SOUND_THREAD_REQUEST_HANDLER RequestHandler, + IN SOUND_THREAD_IO_COMPLETION_HANDLER IoCompletionHandler, IN LPVOID PrivateThreadData) { PSOUND_THREAD SoundThread = NULL; @@ -166,10 +193,14 @@ SoundThread->PrivateData = PrivateThreadData; SoundThread->Running = FALSE; SoundThread->Handle = INVALID_HANDLE_VALUE; + SoundThread->RequestHandler = RequestHandler; SoundThread->ReadyEvent = INVALID_HANDLE_VALUE; SoundThread->RequestEvent = INVALID_HANDLE_VALUE; SoundThread->DoneEvent = INVALID_HANDLE_VALUE; + + SoundThread->IoCompletionHandler = IoCompletionHandler; + SoundThread->FirstCompletedIo = NULL; /* No need to initialise the requests */ @@ -293,3 +324,92 @@ return MMSYSERR_NOERROR; } + +VOID CALLBACK +CompleteSoundThreadIo( + IN DWORD dwErrorCode, + IN DWORD dwNumberOfBytesTransferred, + IN LPOVERLAPPED lpOverlapped) +{ + PSOUND_DEVICE_INSTANCE SoundDeviceInstance; + PSOUND_THREAD_OVERLAPPED SoundThreadOverlapped; + PSOUND_THREAD_COMPLETED_IO CompletionData; + + SoundThreadOverlapped = (PSOUND_THREAD_OVERLAPPED) lpOverlapped; + SOUND_ASSERT(SoundThreadOverlapped); + + CompletionData = SoundThreadOverlapped->CompletionData; + SOUND_ASSERT(CompletionData); + + SoundDeviceInstance = SoundThreadOverlapped->SoundDeviceInstance; + SOUND_ASSERT(SoundDeviceInstance); + SOUND_ASSERT(SoundDeviceInstance->Thread); + + SOUND_DEBUG(L"New I/O Completion Callback Called"); + + /* This is going at the start of the list */ + CompletionData->Next = SoundDeviceInstance->Thread->FirstCompletedIo; + SoundDeviceInstance->Thread->FirstCompletedIo = CompletionData; + + /* Whatever information was supplied to us originally by the caller */ + CompletionData->ContextData = SoundThreadOverlapped->ContextData; + + /* How much data was transferred */ + CompletionData->BytesTransferred = dwNumberOfBytesTransferred; + + /* Overlapped structure gets freed now, but we still need the completion */ + FreeMemory(SoundThreadOverlapped); + + SOUND_DEBUG(L"New I/O Completion Callback Done"); +} + +MMRESULT +OverlappedWriteToSoundDevice( + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, + IN PVOID ContextData, + IN PVOID Buffer, + IN DWORD BufferSize) +{ + PSOUND_THREAD_OVERLAPPED Overlapped; + PSOUND_THREAD_COMPLETED_IO CompletedIo; + + if ( ! SoundDeviceInstance ) + return MMSYSERR_INVALPARAM; + + if ( ! SoundDeviceInstance->Thread ) + return MMSYSERR_ERROR; /* FIXME - better return code? */ + + if ( ! Buffer ) + return MMSYSERR_INVALPARAM; + + /* This will contain information about the write operation */ + Overlapped = AllocateMemoryFor(SOUND_THREAD_OVERLAPPED); + if ( ! Overlapped ) + return MMSYSERR_NOMEM; + + /* We collect this on I/O completion */ + CompletedIo = AllocateMemoryFor(SOUND_THREAD_COMPLETED_IO); + if ( ! CompletedIo ) + { + FreeMemory(Overlapped); + return MMSYSERR_NOMEM; + } + + ZeroMemory(Overlapped, sizeof(SOUND_THREAD_OVERLAPPED)); + ZeroMemory(CompletedIo, sizeof(SOUND_THREAD_COMPLETED_IO)); + + /* We'll want to know which device to queue completion data to */ + Overlapped->SoundDeviceInstance = SoundDeviceInstance; + + /* Caller-supplied data, gets passed back on completion */ + Overlapped->ContextData = ContextData; + + /* The completion data buffer which will be filled later */ + Overlapped->CompletionData = CompletedIo; + + return WriteSoundDeviceBuffer(SoundDeviceInstance, + Buffer, + BufferSize, + CompleteSoundThreadIo, + (LPOVERLAPPED) Overlapped); +} Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wavethread.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wavethread.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wavethread.c [iso-8859-1] Sun Jul 6 18:12:29 2008 @@ -10,6 +10,7 @@ History: 4 July 2008 - Created + 6 July 2008 - Restructured to hide some of the low-level threading TODO: Track if a buffer has already been inserted? @@ -20,35 +21,10 @@ #include <mmebuddy.h> -MMRESULT -WriteWaveBufferToSoundDevice( - IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, - IN PWAVE_THREAD_DATA ThreadData, - IN PWAVEHDR WaveHeader); - - - -VOID CALLBACK -WaveBufferCompleted( - IN DWORD dwErrorCode, - IN DWORD dwNumberOfBytesTransferred, - IN LPOVERLAPPED lpOverlapped) -{ - PWAVE_OVERLAPPED WaveOverlapped = (PWAVE_OVERLAPPED) lpOverlapped; - /*PWAVE_THREAD_DATA ThreadData = WaveOverlapped->ThreadData;*/ - WCHAR msg[1024]; - - wsprintf(msg, L"Buffer %x done\nWrote %d bytes\nErrCode %d", - WaveOverlapped->Header, - dwNumberOfBytesTransferred, - dwErrorCode); - - MessageBox(0, msg, L"File IO Callback", MB_OK | MB_TASKMODAL); - - WriteWaveBufferToSoundDevice(WaveOverlapped->SoundDeviceInstance, - WaveOverlapped->ThreadData, - WaveOverlapped->Header); -} + +/* + Just a neat wrapper around the writing routine. +*/ MMRESULT WriteWaveBufferToSoundDevice( @@ -60,21 +36,16 @@ SOUND_ASSERT(ThreadData); SOUND_ASSERT(WaveHeader); - /* Prepare our overlapped data */ - ZeroMemory(&ThreadData->Overlapped, sizeof(WAVE_OVERLAPPED)); - ThreadData->Overlapped.SoundDeviceInstance = SoundDeviceInstance; - ThreadData->Overlapped.ThreadData = ThreadData; - ThreadData->Overlapped.Header = WaveHeader; - - return WriteSoundDeviceBuffer(SoundDeviceInstance, - WaveHeader->lpData, - WaveHeader->dwBufferLength, - WaveBufferCompleted, - (LPOVERLAPPED) &ThreadData->Overlapped); -} - - -/* Internal dispatch routines */ + return OverlappedWriteToSoundDevice(SoundDeviceInstance, + (PVOID) WaveHeader, + WaveHeader->lpData, + WaveHeader->dwBufferLength); +} + + +/* + Private thread dispatch routines +*/ MMRESULT SubmitWaveBuffer( @@ -123,7 +94,9 @@ } -/* Thread callback */ +/* + Thread request dispatcher +*/ MMRESULT ProcessWaveThreadRequest( @@ -155,6 +128,48 @@ return MMSYSERR_NOTSUPPORTED; } + + +/* + I/O completion + Called from outside the overlapped I/O completion APC +*/ + +VOID +ProcessWaveIoCompletion( + IN struct _SOUND_DEVICE_INSTANCE* Instance, + IN PVOID ContextData, + IN DWORD BytesTransferred) +{ + LPWAVEHDR WaveHeader = (LPWAVEHDR) ContextData; + + SOUND_DEBUG(L"ProcessWaveIoCompletion called :)"); + SOUND_DEBUG_HEX(WaveHeader); + + /* + At this point we know: + - The sound device instance involved in the transaction + - The wave header for the buffer which just completed + - How much data was transferred + + The next task is to figure out how much of the buffer + got played, and enqueue the next buffer if the current + one has been completed. + + Basically, this routine is responsible for keeping the + stream of audio data to/from the sound driver going. + + When no more WAVEHDRs are queued (ie, WaveHeader->lpNext + is NULL), no more buffers are submitted and the sound + thread will wait for more requests from the client before + it does anything else. + */ +} + + +/* + Wave thread start/stop routines +*/ MMRESULT StartWaveThread( @@ -181,6 +196,7 @@ /* Kick off the thread */ Result = StartSoundThread(Instance, ProcessWaveThreadRequest, + ProcessWaveIoCompletion, WaveThreadData); if ( Result != MMSYSERR_NOERROR ) {
16 years, 5 months
1
0
0
0
[cfinck] 34348: Fix buggy MB_LEN_MAX definition according to MSVC headers
by cfinck@svn.reactos.org
Author: cfinck Date: Sun Jul 6 17:56:19 2008 New Revision: 34348 URL:
http://svn.reactos.org/svn/reactos?rev=34348&view=rev
Log: Fix buggy MB_LEN_MAX definition according to MSVC headers Modified: trunk/reactos/include/crt/limits.h Modified: trunk/reactos/include/crt/limits.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/crt/limits.h?rev=3…
============================================================================== --- trunk/reactos/include/crt/limits.h [iso-8859-1] (original) +++ trunk/reactos/include/crt/limits.h [iso-8859-1] Sun Jul 6 17:56:19 2008 @@ -32,11 +32,9 @@ /* * Characteristics of the char data type. - * - * TODO: Is MB_LEN_MAX correct? */ #define CHAR_BIT 8 -#define MB_LEN_MAX 2 +#define MB_LEN_MAX 5 #define SCHAR_MIN (-128) #define SCHAR_MAX 127
16 years, 5 months
1
0
0
0
[cfinck] 34347: Revert r34346, it didn't work the way I thought because of different CRT's on every host. Using gcc/g++ as the frontend will link to it automatically. Sorry for the wasted commit.
by cfinck@svn.reactos.org
Author: cfinck Date: Sun Jul 6 17:32:07 2008 New Revision: 34347 URL:
http://svn.reactos.org/svn/reactos?rev=34347&view=rev
Log: Revert r34346, it didn't work the way I thought because of different CRT's on every host. Using gcc/g++ as the frontend will link to it automatically. Sorry for the wasted commit. Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/mingw…
============================================================================== --- trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp [iso-8859-1] (original) +++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp [iso-8859-1] Sun Jul 6 17:32:07 2008 @@ -2462,9 +2462,14 @@ string objectsMacro = GetObjectsMacro ( module ); string linkDepsMacro = GetLinkingDependenciesMacro (); string libsMacro = GetLibsMacro (); - string linker = "${host_ld}"; GenerateRules (); + + string linker; + if ( module.cplusplus ) + linker = "${host_gpp}"; + else + linker = "${host_gcc}"; const FileLocation *target_file = GetTargetFilename ( module, NULL ); fprintf ( fMakefile, "%s: %s %s | %s\n",
16 years, 5 months
1
0
0
0
[cfinck] 34346: Also link host binaries with ld and not gcc/g++. Same change was already done for target binaries in r34187.
by cfinck@svn.reactos.org
Author: cfinck Date: Sun Jul 6 17:07:22 2008 New Revision: 34346 URL:
http://svn.reactos.org/svn/reactos?rev=34346&view=rev
Log: Also link host binaries with ld and not gcc/g++. Same change was already done for target binaries in r34187. Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/mingw…
============================================================================== --- trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp [iso-8859-1] (original) +++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp [iso-8859-1] Sun Jul 6 17:07:22 2008 @@ -2462,14 +2462,9 @@ string objectsMacro = GetObjectsMacro ( module ); string linkDepsMacro = GetLinkingDependenciesMacro (); string libsMacro = GetLibsMacro (); + string linker = "${host_ld}"; GenerateRules (); - - string linker; - if ( module.cplusplus ) - linker = "${host_gpp}"; - else - linker = "${host_gcc}"; const FileLocation *target_file = GetTargetFilename ( module, NULL ); fprintf ( fMakefile, "%s: %s %s | %s\n",
16 years, 5 months
1
0
0
0
[ekohl] 34345: Implement a simple dialog for adding a user to user groups.
by ekohl@svn.reactos.org
Author: ekohl Date: Sun Jul 6 16:20:28 2008 New Revision: 34345 URL:
http://svn.reactos.org/svn/reactos?rev=34345&view=rev
Log: Implement a simple dialog for adding a user to user groups. Modified: trunk/reactos/dll/cpl/usrmgr/lang/en-US.rc trunk/reactos/dll/cpl/usrmgr/resource.h trunk/reactos/dll/cpl/usrmgr/userprops.c Modified: trunk/reactos/dll/cpl/usrmgr/lang/en-US.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/lang/en-US.…
============================================================================== --- trunk/reactos/dll/cpl/usrmgr/lang/en-US.rc [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/usrmgr/lang/en-US.rc [iso-8859-1] Sun Jul 6 16:20:28 2008 @@ -62,7 +62,7 @@ LTEXT "Member of:", -1, 7, 7, 56, 8 CONTROL "", IDC_USER_MEMBERSHIP_LIST, "SysListView32", LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, 7, 18, 238, 173, WS_EX_CLIENTEDGE - PUSHBUTTON "Add...", IDC_USER_MEMBERSHIP_ADD, 7, 197, 50, 14, WS_DISABLED + PUSHBUTTON "Add...", IDC_USER_MEMBERSHIP_ADD, 7, 197, 50, 14 PUSHBUTTON "Remove", IDC_USER_MEMBERSHIP_REMOVE, 61, 197, 50, 14, WS_DISABLED END @@ -156,6 +156,19 @@ END +IDD_USER_ADD_MEMBERSHIP DIALOGEX DISCARDABLE 0, 0, 252, 223 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT +CAPTION "Group Membership" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Member of:", -1, 7, 7, 56, 8 + CONTROL "", IDC_USER_ADD_MEMBERSHIP_LIST, "SysListView32", LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, + 7, 18, 238, 173, WS_EX_CLIENTEDGE + DEFPUSHBUTTON "OK",IDOK,156,197,50,14 + PUSHBUTTON "Cancel",IDCANCEL,210,197,50,14 +END + + /* Menus */ IDM_POPUP_GROUP MENU DISCARDABLE Modified: trunk/reactos/dll/cpl/usrmgr/resource.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/resource.h?…
============================================================================== --- trunk/reactos/dll/cpl/usrmgr/resource.h [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/usrmgr/resource.h [iso-8859-1] Sun Jul 6 16:20:28 2008 @@ -87,6 +87,9 @@ #define IDC_GROUP_NEW_DESCRIPTION 392 +#define IDD_USER_ADD_MEMBERSHIP 400 +#define IDC_USER_ADD_MEMBERSHIP_LIST 401 + /* Strings */ #define IDS_CPLNAME 2000 Modified: trunk/reactos/dll/cpl/usrmgr/userprops.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/userprops.c…
============================================================================== --- trunk/reactos/dll/cpl/usrmgr/userprops.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/usrmgr/userprops.c [iso-8859-1] Sun Jul 6 16:20:28 2008 @@ -365,6 +365,232 @@ } +static VOID +InitUserGroupsList(HWND hwndDlg) +{ + HWND hwndLV; + LV_COLUMN column; + RECT rect; + TCHAR szStr[32]; + + NET_API_STATUS netStatus; + PLOCALGROUP_INFO_1 pBuffer; + DWORD entriesread; + DWORD totalentries; + DWORD resume_handle = 0; + DWORD i; + LV_ITEM lvi; + INT iItem; + + HIMAGELIST hImgList; + HICON hIcon; + + hwndLV = GetDlgItem(hwndDlg, IDC_USER_ADD_MEMBERSHIP_LIST); + GetClientRect(hwndLV, &rect); + + hImgList = ImageList_Create(16,16,ILC_COLOR8 | ILC_MASK,5,5); + hIcon = LoadImage(hApplet,MAKEINTRESOURCE(IDI_GROUP),IMAGE_ICON,16,16,LR_DEFAULTCOLOR); + ImageList_AddIcon(hImgList,hIcon); + DestroyIcon(hIcon); + + (void)ListView_SetImageList(hwndLV, hImgList, LVSIL_SMALL); + (void)ListView_SetExtendedListViewStyle(hwndLV, LVS_EX_FULLROWSELECT); + + memset(&column, 0x00, sizeof(column)); + column.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM | LVCF_TEXT; + column.fmt = LVCFMT_LEFT; + column.cx = (INT)((rect.right - rect.left) * 0.40); + column.iSubItem = 0; + LoadString(hApplet, IDS_NAME, szStr, sizeof(szStr) / sizeof(szStr[0])); + column.pszText = szStr; + (void)ListView_InsertColumn(hwndLV, 0, &column); + + column.cx = (INT)((rect.right - rect.left) * 0.60); + column.iSubItem = 1; + LoadString(hApplet, IDS_DESCRIPTION, szStr, sizeof(szStr) / sizeof(szStr[0])); + column.pszText = szStr; + (void)ListView_InsertColumn(hwndLV, 1, &column); + + for (;;) + { + netStatus = NetLocalGroupEnum(NULL, 1, (LPBYTE*)&pBuffer, + 1024, &entriesread, + &totalentries, &resume_handle); + if (netStatus != NERR_Success && netStatus != ERROR_MORE_DATA) + break; + + for (i = 0; i < entriesread; i++) + { + memset(&lvi, 0x00, sizeof(lvi)); + lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_IMAGE; + lvi.pszText = pBuffer[i].lgrpi1_name; + lvi.state = 0; + lvi.iImage = 0; + iItem = ListView_InsertItem(hwndLV, &lvi); + + ListView_SetItemText(hwndLV, iItem, 1, + pBuffer[i].lgrpi1_comment); + } + + NetApiBufferFree(&pBuffer); + + /* No more data left */ + if (netStatus != ERROR_MORE_DATA) + break; + } +} + + +static BOOL +AddSelectedGroupsToUser(HWND hwndDlg, + PMEMBERSHIP_USER_DATA pUserData) +{ + HWND hwndLV; + INT nItem; + TCHAR szGroupName[UNLEN]; + BOOL bResult = FALSE; + BOOL bFound; + DWORD i; + LOCALGROUP_MEMBERS_INFO_3 memberInfo; + NET_API_STATUS status; + + hwndLV = GetDlgItem(hwndDlg, IDC_USER_ADD_MEMBERSHIP_LIST); + + if (ListView_GetSelectedCount(hwndLV) > 0) + { + nItem = ListView_GetNextItem(hwndLV, -1, LVNI_SELECTED); + while (nItem != -1) + { + /* Get the new user name */ + ListView_GetItemText(hwndLV, + nItem, 0, + szGroupName, + UNLEN); + + bFound = FALSE; + for (i = 0; i < pUserData->dwGroupCount; i++) + { + if (_tcscmp(pUserData->pGroupData[i].lgrui0_name, szGroupName) == 0) + bFound = TRUE; + } + + if (!bFound) + { + memberInfo.lgrmi3_domainandname = pUserData->szUserName; + + status = NetLocalGroupAddMembers(NULL, szGroupName, 3, + (LPBYTE)&memberInfo, 1); + if (status == NERR_Success) + { + DebugPrintf(_TEXT("Selected group: %s"), szGroupName); + bResult = TRUE; + } + else + { + TCHAR szText[256]; + wsprintf(szText, TEXT("Error: %u"), status); + MessageBox(NULL, szText, TEXT("NetLocalGroupAddMembers"), MB_ICONERROR | MB_OK); + } + } + + nItem = ListView_GetNextItem(hwndLV, nItem, LVNI_SELECTED); + } + } + + return bResult; +} + + +INT_PTR CALLBACK +AddGroupToUserDlgProc(HWND hwndDlg, + UINT uMsg, + WPARAM wParam, + LPARAM lParam) +{ + PMEMBERSHIP_USER_DATA pUserData; + + UNREFERENCED_PARAMETER(wParam); + + pUserData= (PMEMBERSHIP_USER_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER); + + switch (uMsg) + { + case WM_INITDIALOG: + pUserData= (PMEMBERSHIP_USER_DATA)lParam; + SetWindowLongPtr(hwndDlg, DWLP_USER, (INT_PTR)pUserData); + InitUserGroupsList(hwndDlg); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDOK: + if (AddSelectedGroupsToUser(hwndDlg, pUserData)) + EndDialog(hwndDlg, IDOK); + else + EndDialog(hwndDlg, IDCANCEL); + break; + + case IDCANCEL: + EndDialog(hwndDlg, IDCANCEL); + break; + } + break; + + default: + return FALSE; + } + + return TRUE; +} + + +static VOID +AddGroupToUser(HWND hwndDlg, + PMEMBERSHIP_USER_DATA pUserData) +{ + HWND hwndLV; + NET_API_STATUS status; + DWORD i; + DWORD dwTotal; + LV_ITEM lvi; + + if (DialogBoxParam(hApplet, + MAKEINTRESOURCE(IDD_USER_ADD_MEMBERSHIP), + hwndDlg, + AddGroupToUserDlgProc, + (LPARAM)pUserData) == IDOK) + { + // TODO: Update Membership list! + hwndLV = GetDlgItem(hwndDlg, IDC_USER_MEMBERSHIP_LIST); + + if (pUserData->pGroupData) + NetApiBufferFree(pUserData->pGroupData); + + (void)ListView_DeleteAllItems(hwndLV); + + status = NetUserGetLocalGroups(NULL, pUserData->szUserName, 0, 0, + (LPBYTE*)&pUserData->pGroupData, + MAX_PREFERRED_LENGTH, + &pUserData->dwGroupCount, + &dwTotal); + if (status != NERR_Success) + return; + + for (i = 0; i < pUserData->dwGroupCount; i++) + { + ZeroMemory(&lvi, sizeof(lvi)); + lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_IMAGE; + lvi.pszText = pUserData->pGroupData[i].lgrui0_name; + lvi.state = 0; + lvi.iImage = 0; + + (void)ListView_InsertItem(hwndLV, &lvi); + } + } +} + + static BOOL OnNotify(HWND hwndDlg, PMEMBERSHIP_USER_DATA pUserData, @@ -427,6 +653,10 @@ case WM_COMMAND: switch (LOWORD(wParam)) { + case IDC_USER_MEMBERSHIP_ADD: + AddGroupToUser(hwndDlg, pUserData); + break; + case IDC_USER_MEMBERSHIP_REMOVE: RemoveGroupFromUser(hwndDlg, pUserData); break;
16 years, 5 months
1
0
0
0
[janderwald] 34344: - fix potential buffer overflows spotted by Christoph
by janderwald@svn.reactos.org
Author: janderwald Date: Sun Jul 6 15:52:11 2008 New Revision: 34344 URL:
http://svn.reactos.org/svn/reactos?rev=34344&view=rev
Log: - fix potential buffer overflows spotted by Christoph Modified: trunk/reactos/dll/win32/shell32/fprop.c Modified: trunk/reactos/dll/win32/shell32/fprop.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/fprop.c?…
============================================================================== --- trunk/reactos/dll/win32/shell32/fprop.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/fprop.c [iso-8859-1] Sun Jul 6 15:52:11 2008 @@ -678,13 +678,16 @@ pOffset = wcsrchr(wFileName, L'.'); if (!pOffset) { + Length = wcslen(szName); + if (Length >=94) + return 0; wcscpy(szName, L"CLSID\\"); wcscpy(&szName[6], wFileName); } else { Length = wcslen(pOffset); - if (Length >= 70) + if (Length >= 100) return 0; wcscpy(szName, pOffset); } @@ -700,6 +703,7 @@ if (RegGetValueW(HKEY_CLASSES_ROOT, pOffset, NULL, RRF_RT_REG_SZ, NULL, szName, &dwName) == ERROR_SUCCESS) { TRACE("EnumPropSheetExt szName %s, pOffset %s\n", debugstr_w(szName), debugstr_w(pOffset)); + szName[(sizeof(szName)/sizeof(WCHAR))-1] = L'\0'; hpsxa[1] = SHCreatePropSheetExtArrayEx(HKEY_CLASSES_ROOT, szName, NumPages - Pages, pDataObj); Pages +=SHAddFromPropSheetExtArray(hpsxa[1], AddShellPropSheetExCallback, (LPARAM)hppages); }
16 years, 5 months
1
0
0
0
[cfinck] 34343: Remixed our Win32 version of ccache: - Mix in parts of a patch by Brant Young, which itself is based on an old patch by Filip (see http://code.google.com/p/ccache-win32/wiki/WhyNativeWin32Ccache) - Change bInheritHandles for the CreateProcess call in failed() to TRUE, so that the compilation of the RC files works (they are preprocessed with gcc and piped to a file) - Add a safe version of mkstemp based on glibc sources, so that we don't run into race condition problems - Use CSID
by cfinck@svn.reactos.org
Author: cfinck Date: Sun Jul 6 15:49:03 2008 New Revision: 34343 URL:
http://svn.reactos.org/svn/reactos?rev=34343&view=rev
Log: Remixed our Win32 version of ccache: - Mix in parts of a patch by Brant Young, which itself is based on an old patch by Filip (see
http://code.google.com/p/ccache-win32/wiki/WhyNativeWin32Ccache
) - Change bInheritHandles for the CreateProcess call in failed() to TRUE, so that the compilation of the RC files works (they are preprocessed with gcc and piped to a file) - Add a safe version of mkstemp based on glibc sources, so that we don't run into race condition problems - Use CSIDL_LOCAL_APPDATA as the default base path for the ccache directory, not CSIDL_PROFILE Added: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/mkstemp.c (with props) Modified: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/Makefile trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache-win32.vcproj trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache.c trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache.h trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/execute.c trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/unify.c trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/util.c Modified: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/Makefile URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Tools/cc…
============================================================================== --- trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/Makefile [iso-8859-1] (original) +++ trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/Makefile [iso-8859-1] Sun Jul 6 15:49:03 2008 @@ -9,7 +9,7 @@ CC=gcc CFLAGS := -Wall -pedantic -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0400 -O2 LFLAGS := -s -SRCS := args.c ccache.c cleanup.c execute.c getopt.c hash.c mdfour.c snprintf.c stats.c unify.c util.c win32-dirent.c +SRCS := args.c ccache.c cleanup.c execute.c getopt.c hash.c mdfour.c mkstemp.c snprintf.c stats.c unify.c util.c win32-dirent.c OBJS := $(SRCS:.c=.o) $(TARGET): $(OBJS) Modified: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache-win32.vcproj URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Tools/cc…
============================================================================== --- trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache-win32.vcproj [iso-8859-1] (original) +++ trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache-win32.vcproj [iso-8859-1] Sun Jul 6 15:49:03 2008 @@ -112,7 +112,7 @@ /> <Tool Name="VCCLCompilerTool" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="4" @@ -197,6 +197,10 @@ > </File> <File + RelativePath=".\mkstemp.c" + > + </File> + <File RelativePath=".\snprintf.c" > </File> Modified: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache.c URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Tools/cc…
============================================================================== --- trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache.c [iso-8859-1] (original) +++ trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache.c [iso-8859-1] Sun Jul 6 15:49:03 2008 @@ -165,7 +165,7 @@ si.cb = sizeof(STARTUPINFOA); - if(!CreateProcessA(orig_args->argv[0], merged, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) + if(!CreateProcessA(orig_args->argv[0], merged, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi)) { perror(orig_args->argv[0]); exit(1); Modified: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache.h URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Tools/cc…
============================================================================== --- trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache.h [iso-8859-1] (original) +++ trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache.h [iso-8859-1] Sun Jul 6 15:49:03 2008 @@ -42,8 +42,7 @@ #define mkdir(dirname, access) _mkdir(dirname) #define x_realpath(a) strdup(a) #define link(filename, linkname) CreateHardLinkA(linkname, filename, NULL) - #define PROT_READ 0x0001 - #define MAP_PRIVATE 0x02 + #define lstat(x, y) stat(x, y) #ifdef _MSC_VER typedef unsigned int mode_t; @@ -55,7 +54,8 @@ #ifndef S_ISDIR #define S_ISDIR(m) (((m) & _S_IFDIR) == _S_IFDIR) #endif - #define lstat(x, y) stat(x, y) + + int mkstemp (char *template); #else #include <unistd.h> #include <sys/wait.h> Modified: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/execute.c URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Tools/cc…
============================================================================== --- trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/execute.c [iso-8859-1] (original) +++ trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/execute.c [iso-8859-1] Sun Jul 6 15:49:03 2008 @@ -18,16 +18,90 @@ #include "ccache.h" +#ifdef _WIN32 +static char *argvtos(char **argv) +{ + int i, len; + char *ptr, *str; + + for (i = 0, len = 0; argv[i]; i++) { + len += strlen(argv[i]) + 3; + } + + str = ptr = (char *)malloc(len + 1); + if (str == NULL) + return NULL; + + for (i = 0; argv[i]; i++) { + len = strlen(argv[i]); + *ptr++ = '"'; + memcpy(ptr, argv[i], len); + ptr += len; + *ptr++ = '"'; + *ptr++ = ' '; + } + *ptr = 0; + + return str; +} +#endif /* execute a compiler backend, capturing all output to the given paths the full path to the compiler to run is in argv[0] */ -int execute(char **argv, +int execute(char **argv, const char *path_stdout, const char *path_stderr) { -#ifndef _WIN32 +#ifdef _WIN32 + PROCESS_INFORMATION pinfo; + STARTUPINFOA sinfo; + BOOL ret; + DWORD exitcode; + char *args; + HANDLE fd_out, fd_err; + SECURITY_ATTRIBUTES sa = {sizeof(SECURITY_ATTRIBUTES), NULL, TRUE}; + + fd_out = CreateFileA(path_stdout, GENERIC_WRITE, 0, &sa, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (fd_out == INVALID_HANDLE_VALUE) { + return STATUS_NOCACHE; + } + + fd_err = CreateFileA(path_stderr, GENERIC_WRITE, 0, &sa, CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL, NULL); + if (fd_err == INVALID_HANDLE_VALUE) { + return STATUS_NOCACHE; + } + + ZeroMemory(&pinfo, sizeof(PROCESS_INFORMATION)); + ZeroMemory(&sinfo, sizeof(STARTUPINFOA)); + + sinfo.cb = sizeof(STARTUPINFOA); + sinfo.hStdError = fd_err; + sinfo.hStdOutput = fd_out; + sinfo.hStdInput = GetStdHandle(STD_INPUT_HANDLE); + sinfo.dwFlags |= STARTF_USESTDHANDLES; + + args = argvtos(argv); + + ret = CreateProcessA(argv[0], args, NULL, NULL, TRUE, 0, NULL, NULL, + &sinfo, &pinfo); + + free(args); + CloseHandle(fd_out); + CloseHandle(fd_err); + + if (ret == 0) + return -1; + + WaitForSingleObject(pinfo.hProcess, INFINITE); + GetExitCodeProcess(pinfo.hProcess, &exitcode); + CloseHandle(pinfo.hProcess); + CloseHandle(pinfo.hThread); + + return exitcode; +#else pid_t pid; int status; @@ -65,46 +139,6 @@ } return WEXITSTATUS(status); -#else /* Should be portable */ - int status = -2; - int fd, std_od = -1, std_ed = -1; - - unlink(path_stdout); - std_od = _dup(1); - fd = _open(path_stdout, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL|O_BINARY, 0666); - if (fd == -1) { - status = STATUS_NOCACHE; - cc_log("stdout error: failed to open %s\n", path_stdout); - goto out; - } - /*std_od = */ _dup2(fd, 1); - _close(fd); - - unlink(path_stderr); - fd = _open(path_stderr, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL|O_BINARY, 0666); - std_ed = _dup(2); - if (fd == -1) { - status = STATUS_NOCACHE; - cc_log("stderr error: failed to open %s\n", path_stderr); - goto out; - } - /*std_ed =*/ _dup2(fd, 2); - _close(fd); - - /* Spawn process (_exec* familly doesn't return) */ - status = _spawnv(_P_WAIT, argv[0], (const char* const*)argv); - - out: - cc_log("%s:\n stdout -> %s\n stderr -> %s\n process status=%i\n", - argv[0], path_stdout, path_stderr, status); - if (status == -1) cc_log("Error %i: %s\n", errno, strerror(errno)); - - /* Restore descriptors */ - if (std_od != -1) _dup2(std_od, 1); - if (std_ed != -1) _dup2(std_ed, 2); - _flushall(); - - return (status>0); #endif } @@ -158,11 +192,24 @@ */ char *find_executable(const char *name, const char *exclude_name) { +#ifdef _WIN32 + DWORD ret; + char namebuf[MAX_PATH]; + + UNREFERENCED_PARAMETER(exclude_name); + + ret = SearchPathA(getenv("CCACHE_PATH"), name, ".exe", sizeof(namebuf), namebuf, NULL); + if (ret != 0) { + return x_strdup(namebuf); + } + + return NULL; +#else char *path; char *tok; - const char *sep = ":"; - - if (*name == PATH_SEP_CHAR) { + struct stat st1, st2; + + if (*name == '/') { return x_strdup(name); } @@ -177,37 +224,40 @@ path = x_strdup(path); - /* Determine path separator */ - if (strchr(path, ';')) sep = ";"; - /* search the path looking for the first compiler of the right name that isn't us */ - for (tok=strtok(path, sep); tok; tok = strtok(NULL, sep)) { + for (tok=strtok(path,":"); tok; tok = strtok(NULL, ":")) { char *fname; - x_asprintf(&fname, "%s"PATH_SEP"%s", tok, name); + x_asprintf(&fname, "%s/%s", tok, name); /* look for a normal executable file */ - - - if (is_exec_file(fname, exclude_name) > 0) - { + if (access(fname, X_OK) == 0 && + lstat(fname, &st1) == 0 && + stat(fname, &st2) == 0 && + S_ISREG(st2.st_mode)) { + /* if its a symlink then ensure it doesn't + point at something called exclude_name */ + if (S_ISLNK(st1.st_mode)) { + char *buf = x_realpath(fname); + if (buf) { + char *p = str_basename(buf); + if (strcmp(p, exclude_name) == 0) { + /* its a link to "ccache" ! */ + free(p); + free(buf); + continue; + } + free(buf); + free(p); + } + } + + /* found it! */ free(path); return fname; } free(fname); - - /* found it! */ -#ifdef _WIN32 /* Add .exe under win32 */ - x_asprintf(&fname, "%s"PATH_SEP"%s.exe", tok, name); - - /* look for a normal executable file */ - if (is_exec_file(fname, exclude_name) > 0) - { - free(path); - return fname; - } - free(fname); -#endif - } -free(path); + } + return NULL; -} +#endif +} Added: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/mkstemp.c URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Tools/cc…
============================================================================== --- trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/mkstemp.c (added) +++ trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/mkstemp.c [iso-8859-1] Sun Jul 6 15:49:03 2008 @@ -1,0 +1,84 @@ +#ifdef _WIN32 +/* Copyright (C) 1998, 1999, 2001, 2007 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C 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. + + The GNU C 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 the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* Ported for ccache-win32 by Colin Finck <colin(a)reactos.org> + Source:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/posix/tempname.c?…
+*/ + +#include "ccache.h" + +/* These are the characters used in temporary filenames. */ +static const char letters[] = +"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + +/* Generate a unique temporary file name from TEMPLATE. + The last six characters of TEMPLATE must be "XXXXXX"; + they are replaced with a string that makes the filename unique. + Then open the file and return a fd. */ +int +mkstemp (char *template) +{ + char *XXXXXX; + time_t value; + unsigned int count; + int fd; + + /* A lower bound on the number of temporary files to attempt to + generate. The maximum total number of temporary file names that + can exist for a given template is 62**6. It should never be + necessary to try all these combinations. Instead if a reasonable + number of names is tried (we define reasonable as 62**3) fail to + give the system administrator the chance to remove the problems. */ + unsigned int attempts = (62 * 62 * 62); + + /* This is where the Xs start. */ + XXXXXX = &template[ strlen(template) - 6 ]; + + /* Get some more or less random data. */ + value = time(NULL) ^ _getpid(); + + for (count = 0; count < attempts; value += 7777, ++count) + { + time_t v = value; + + /* Fill in the random bits. */ + XXXXXX[0] = letters[v % 62]; + v /= 62; + XXXXXX[1] = letters[v % 62]; + v /= 62; + XXXXXX[2] = letters[v % 62]; + v /= 62; + XXXXXX[3] = letters[v % 62]; + v /= 62; + XXXXXX[4] = letters[v % 62]; + v /= 62; + XXXXXX[5] = letters[v % 62]; + + fd = _open (template, O_RDWR | O_BINARY | O_CREAT | O_EXCL, 0600); + + if (fd >= 0) + return fd; + else if (errno != EEXIST) + return -1; + } + + /* We got out of the loop because we ran out of combinations to try. */ + return -1; +} +#endif Propchange: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/mkstemp.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/unify.c URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Tools/cc…
============================================================================== --- trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/unify.c [iso-8859-1] (original) +++ trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/unify.c [iso-8859-1] Sun Jul 6 15:49:03 2008 @@ -238,10 +238,40 @@ */ int unify_hash(const char *fname) { +#ifdef _WIN32 + HANDLE file; + HANDLE section; + MEMORY_BASIC_INFORMATION minfo; + char *map; + + file = CreateFileA(fname, GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, 0, NULL); + if (file == INVALID_HANDLE_VALUE) + return -1; + + section = CreateFileMappingA(file, NULL, PAGE_READONLY, 0, 0, NULL); + CloseHandle(file); + if (section == NULL) + return -1; + + map = MapViewOfFile(section, FILE_MAP_READ, 0, 0, 0); + CloseHandle(section); + if (map == NULL) + return -1; + + if (VirtualQuery(map, &minfo, sizeof(minfo)) != sizeof(minfo)) { + UnmapViewOfFile(map); + return -1; + } + + /* pass it through the unifier */ + unify((unsigned char *)map, minfo.RegionSize); + + UnmapViewOfFile(map); +#else int fd; struct stat st; char *map; - HANDLE view; fd = open(fname, O_RDONLY|O_BINARY); if (fd == -1 || fstat(fd, &st) != 0) { @@ -250,33 +280,6 @@ return -1; } -#ifdef _WIN32 - /* win32 equivalent of mmap is ViewMapOfFile, but malloc+read - may be better */ - view = CreateFileMapping((HANDLE)_get_osfhandle(fd), NULL, - PAGE_READONLY|SEC_COMMIT, 0,0 , NULL); - if (NULL == view) { - cc_log("Failed to create file mapping %s: %s\n", - fname, strerror(errno)); - stats_update(STATS_PREPROCESSOR); - return -1; - } - - map = MapViewOfFile(view, FILE_MAP_READ, 0, 0, st.st_size); - if (NULL == map) { - cc_log("Failed to map view of file %s: %s\n", - fname, strerror(errno)); - stats_update(STATS_PREPROCESSOR); - return -1; - } - - /* pass it through the unifier */ - unify((unsigned char *)map, st.st_size); - - UnmapViewOfFile(map); - CloseHandle(view); - close(fd); -#else /* we use mmap() to make it easy to handle arbitrarily long lines in preprocessor output. I have seen lines of over 100k in length, so this is well worth it */ @@ -292,6 +295,7 @@ munmap(map, st.st_size); #endif + return 0; } Modified: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/util.c URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Tools/cc…
============================================================================== --- trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/util.c [iso-8859-1] (original) +++ trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/util.c [iso-8859-1] Sun Jul 6 15:49:03 2008 @@ -20,19 +20,6 @@ static FILE *logfile; -#ifdef _WIN32 -#define fchmod(a, b) -#endif - -#ifndef HAVE_MKSTEMP -/* cheap and nasty mkstemp replacement */ -int mkstemp(char *template) -{ - _mktemp(template); - return open(template, O_RDWR|O_CREAT|O_EXCL|O_BINARY, 0600); -} -#endif - /* log a message to the CCACHE_LOGFILE location */ void cc_log(const char *format, ...) { @@ -79,7 +66,10 @@ char buf[10240]; int n; char *tmp_name; + +#ifndef _WIN32 mode_t mask; +#endif x_asprintf(&tmp_name, "%s.XXXXXX", dest); @@ -109,9 +99,11 @@ close(fd1); /* get perms right on the tmp file */ +#ifndef _WIN32 mask = umask(0); fchmod(fd2, 0666 & ~mask); umask(mask); +#endif /* the close can fail on NFS if out of space */ if (close(fd2) == -1) { @@ -483,8 +475,8 @@ #ifdef _WIN32 static char szPath[MAX_PATH]; - /* "Documents and Settings\user\Application Data" is CSIDL_APPDATA */ - if(SHGetSpecialFolderPathA(NULL, szPath, CSIDL_PROFILE, FALSE)) + /* "Documents and Settings\user\Application Data" is CSIDL_LOCAL_APPDATA */ + if(SHGetSpecialFolderPathA(NULL, szPath, CSIDL_LOCAL_APPDATA, FALSE)) { return szPath; }
16 years, 5 months
1
0
0
0
[fireball] 34342: - Update hlink headers from Wine HEAD.
by fireball@svn.reactos.org
Author: fireball Date: Sun Jul 6 15:44:35 2008 New Revision: 34342 URL:
http://svn.reactos.org/svn/reactos?rev=34342&view=rev
Log: - Update hlink headers from Wine HEAD. Modified: trunk/reactos/include/psdk/hlguids.h trunk/reactos/include/psdk/hlink.idl Modified: trunk/reactos/include/psdk/hlguids.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/hlguids.h?rev…
============================================================================== --- trunk/reactos/include/psdk/hlguids.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/hlguids.h [iso-8859-1] Sun Jul 6 15:44:35 2008 @@ -25,5 +25,7 @@ 0x79eac9d0, 0xbaf9, 0x11ce, 0x8c, 0x82, 0x00, 0xaa,0x00,0x4b,0xa9,0x0b); DEFINE_GUID(CLSID_StdHlinkBrowseContext, 0x79eac9d1, 0xbaf9, 0x11ce, 0x8c, 0x82, 0x00, 0xaa,0x00,0x4b,0xa9,0x0b); +DEFINE_GUID(CLSID_IID_IExtensionServices, + 0x79eac9cb, 0xbaf9, 0x11ce, 0x8c, 0x82, 0x00, 0xaa,0x00,0x4b,0xa9,0x0b); #endif Modified: trunk/reactos/include/psdk/hlink.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/hlink.idl?rev…
============================================================================== --- trunk/reactos/include/psdk/hlink.idl [iso-8859-1] (original) +++ trunk/reactos/include/psdk/hlink.idl [iso-8859-1] Sun Jul 6 15:44:35 2008 @@ -416,3 +416,25 @@ [in, unique] LPCWSTR pwzLocation, [in, unique] LPCWSTR pwzFriendlyName); } + +/***************************************************************************** + * IExtensionServices interface + */ +[ + object, + uuid(79eac9cb-baf9-11ce-8c82-00aa004ba90b), + pointer_default(unique) +] + +interface IExtensionServices: IUnknown +{ + typedef IExtensionServices *LPEXTENSIONSERVICES; + + HRESULT SetAdditionalHeaders( + [in] LPCWSTR pwzAdditionalHeaders); + + HRESULT SetAuthenticateData( + [in] HWND phwnd, + [in] LPCWSTR pwzUsername, + [in] LPCWSTR pwzPassword); +}
16 years, 5 months
1
0
0
0
[janderwald] 34341: - implement IShellPropSheetExt handling for file property dialogs for standard file classes - makes shellink property dialog appear again (and many others ; ) )
by janderwald@svn.reactos.org
Author: janderwald Date: Sun Jul 6 15:35:21 2008 New Revision: 34341 URL:
http://svn.reactos.org/svn/reactos?rev=34341&view=rev
Log: - implement IShellPropSheetExt handling for file property dialogs for standard file classes - makes shellink property dialog appear again (and many others ;) ) Modified: trunk/reactos/dll/win32/shell32/fprop.c Modified: trunk/reactos/dll/win32/shell32/fprop.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/fprop.c?…
============================================================================== --- trunk/reactos/dll/win32/shell32/fprop.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/fprop.c [iso-8859-1] Sun Jul 6 15:35:21 2008 @@ -53,6 +53,7 @@ WORD code; } LANGANDCODEPAGE, *LPLANGANDCODEPAGE; +HPSXA WINAPI SHCreatePropSheetExtArrayEx(HKEY hKey, LPCWSTR pszSubKey, UINT max_iface, IDataObject *pDataObj); /************************************************************************* * * SH_CreatePropertySheetPage [Internal] @@ -630,7 +631,7 @@ lpstr = (WCHAR *)ppsp->lParam; if ( lpstr == NULL) - { + { ERR("no filename\n"); break; } @@ -647,6 +648,66 @@ return FALSE; } +BOOL CALLBACK AddShellPropSheetExCallback(HPROPSHEETPAGE hPage, LPARAM lParam) +{ + UINT iIndex; + HPROPSHEETPAGE * hppages = (HPROPSHEETPAGE *)lParam; + + TRACE("AddShellPropSheetExCallback called\n"); + for(iIndex = 0; iIndex < MAX_PROPERTY_SHEET_PAGE; iIndex++) + { + if (hppages[iIndex] == NULL) + { + hppages[iIndex] = hPage; + return TRUE; + } + } + return FALSE; +} + + +int +EnumPropSheetExt(LPWSTR wFileName, HPROPSHEETPAGE * hppages, int NumPages, HPSXA * hpsxa, IDataObject *pDataObj) +{ + WCHAR szName[100]; + WCHAR * pOffset; + UINT Length; + DWORD dwName; + int Pages; + + pOffset = wcsrchr(wFileName, L'.'); + if (!pOffset) + { + wcscpy(szName, L"CLSID\\"); + wcscpy(&szName[6], wFileName); + } + else + { + Length = wcslen(pOffset); + if (Length >= 70) + return 0; + wcscpy(szName, pOffset); + } + TRACE("EnumPropSheetExt szName %s\n", debugstr_w(szName)); + hpsxa[0] = SHCreatePropSheetExtArrayEx(HKEY_CLASSES_ROOT, szName, NumPages, pDataObj); + Pages = SHAddFromPropSheetExtArray(hpsxa[0], AddShellPropSheetExCallback, (LPARAM)hppages); + + + if (pOffset) + { + /* try to load property sheet handlers from prog id key */ + dwName = sizeof(szName); + if (RegGetValueW(HKEY_CLASSES_ROOT, pOffset, NULL, RRF_RT_REG_SZ, NULL, szName, &dwName) == ERROR_SUCCESS) + { + TRACE("EnumPropSheetExt szName %s, pOffset %s\n", debugstr_w(szName), debugstr_w(pOffset)); + hpsxa[1] = SHCreatePropSheetExtArrayEx(HKEY_CLASSES_ROOT, szName, NumPages - Pages, pDataObj); + Pages +=SHAddFromPropSheetExtArray(hpsxa[1], AddShellPropSheetExCallback, (LPARAM)hppages); + } + } + return Pages; +} + + /************************************************************************* * @@ -670,6 +731,12 @@ UINT num_pages = 0; DWORD dwHandle = 0; WCHAR * pFileName; + HPSXA hpsxa[2]; + INT_PTR res; + LPITEMIDLIST pidlChild, pidlFolder; + WCHAR szTemp[MAX_PATH]; + IDataObject* pDataObj = NULL; + HRESULT hResult; TRACE("SH_ShowPropertiesDialog entered filename %s\n", debugstr_w(lpf)); @@ -701,6 +768,26 @@ FIXME("directory / drive resources are missing\n"); return FALSE; } + + wcscpy(szTemp, wFileName); + pFileName = wcsrchr(szTemp, '\\'); + if (pFileName) + { + pFileName[0] = L'\0'; + pFileName++; + pidlChild = ILCreateFromPathW(pFileName); + pidlFolder = ILCreateFromPathW(szTemp); + if (pidlChild && pidlFolder) + { + hResult = SHCreateDataObject(pidlFolder, 1, (LPCITEMIDLIST*)&pidlChild, NULL, &IID_IDataObject, (LPVOID*)&pDataObj); + ILFree(pidlChild); + ILFree(pidlFolder); + if (hResult != S_OK) + pDataObj = NULL; + } + } + + hpage = SH_CreatePropertySheetPage("SHELL_FILE_GENERAL_DLG", SH_FileGeneralDlgProc, (LPARAM)wFileName, NULL); if (hpage == NULL) @@ -708,7 +795,9 @@ hppages[num_pages] = hpage; num_pages++; - if ( GetFileVersionInfoSizeW(lpf, &dwHandle) ) + num_pages += EnumPropSheetExt(wFileName, hppages, MAX_PROPERTY_SHEET_PAGE-1, hpsxa, pDataObj); + + if ( GetFileVersionInfoSizeW(lpf, &dwHandle) && num_pages) { if ( (hpage = SH_CreatePropertySheetPage("SHELL_FILE_VERSION_DLG",SH_FileVersionDlgProc, (LPARAM)wFileName, NULL))!= NULL) { @@ -730,6 +819,15 @@ pinfo.nPages = num_pages; pinfo.u3.phpage = hppages; pinfo.pszCaption = pFileName; - return (PropertySheetW(&pinfo) != -1); + + TRACE("SH_ShowPropertiesDialog pages %u\n", num_pages); + res = PropertySheetW(&pinfo); + + SHDestroyPropSheetExtArray(hpsxa[0]); + SHDestroyPropSheetExtArray(hpsxa[1]); + if (pDataObj) + IDataObject_Release(pDataObj); + + return (res != -1); } /*EOF */
16 years, 5 months
1
0
0
0
[silverblade] 34340: Some restructuring to avoid SOUND_DEVICE_INSTANCE containing members only relevant to the a wave device thread. Now there are separate structures for device, device instance, thread, and anything relevant to a wave thread. Extended overlapped I/O structure so that the completion routine can identify the device instance, completed wave buffer and thread-specific data. The completion routine re-submits the same buffer repeatedly at present.
by silverblade@svn.reactos.org
Author: silverblade Date: Sun Jul 6 13:57:26 2008 New Revision: 34340 URL:
http://svn.reactos.org/svn/reactos?rev=34340&view=rev
Log: Some restructuring to avoid SOUND_DEVICE_INSTANCE containing members only relevant to the a wave device thread. Now there are separate structures for device, device instance, thread, and anything relevant to a wave thread. Extended overlapped I/O structure so that the completion routine can identify the device instance, completed wave buffer and thread-specific data. The completion routine re-submits the same buffer repeatedly at present. Modified: branches/silverblade-audio/dll/win32/sndblst/sndblst.c branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h branches/silverblade-audio/lib/drivers/sound/mmebuddy/instances.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/kernel.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/mme/wodMessage.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/thread.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wavethread.c Modified: branches/silverblade-audio/dll/win32/sndblst/sndblst.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/dll/win32/snd…
============================================================================== --- branches/silverblade-audio/dll/win32/sndblst/sndblst.c [iso-8859-1] (original) +++ branches/silverblade-audio/dll/win32/sndblst/sndblst.c [iso-8859-1] Sun Jul 6 13:57:26 2008 @@ -132,6 +132,10 @@ WAVEFORMATEX Format; MMRESULT Result; PVOID InstanceData; + int i; + + for ( i = 0; i < 65536; ++ i ) + Buffer[i] = rand(); /* DRV_LOAD */ DriverProc(0, 0, DRV_LOAD, 0, 0); Modified: branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/include/react…
============================================================================== --- branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h [iso-8859-1] (original) +++ branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h [iso-8859-1] Sun Jul 6 13:57:26 2008 @@ -101,18 +101,17 @@ MMRESULT Result; } THREAD_REQUEST, *PTHREAD_REQUEST; - -/* - Thread helper operations -*/ typedef MMRESULT (*SOUND_THREAD_REQUEST_HANDLER)( IN struct _SOUND_DEVICE_INSTANCE* Instance, + IN PVOID PrivateThreadData, IN DWORD RequestId, IN PVOID Data); typedef struct _SOUND_THREAD { + /* Thread management */ HANDLE Handle; + PVOID PrivateData; BOOLEAN Running; SOUND_THREAD_REQUEST_HANDLER RequestHandler; HANDLE ReadyEvent; /* Thread waiting for a request */ @@ -123,8 +122,30 @@ /* + Wave thread +*/ + +typedef struct _WAVE_OVERLAPPED +{ + OVERLAPPED General; + struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance; + struct _WAVE_THREAD_DATA* ThreadData; + PWAVEHDR Header; +} WAVE_OVERLAPPED, *PWAVE_OVERLAPPED; + +typedef struct _WAVE_THREAD_DATA +{ + /* Wave thread specific */ + WAVE_OVERLAPPED Overlapped; + + DWORD BufferCount; + PWAVEHDR CurrentBuffer; + PWAVEHDR FirstBuffer; + PWAVEHDR LastBuffer; +} WAVE_THREAD_DATA, *PWAVE_THREAD_DATA; + +/* Audio device function table - TODO - create/destroy instance need to work */ typedef MMRESULT (*MMCREATEINSTANCE_FUNC)( @@ -193,20 +214,6 @@ { DWORD ClientCallback; } WinMM; - - /* Everything below this is used by the worker thread only */ - OVERLAPPED Overlapped; - - union - { - struct - { - DWORD BufferCount; - PWAVEHDR CurrentBuffer; - PWAVEHDR FirstBuffer; - PWAVEHDR LastBuffer; - } Wave; - }; } SOUND_DEVICE_INSTANCE, *PSOUND_DEVICE_INSTANCE; @@ -359,7 +366,8 @@ IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, IN LPVOID Buffer, IN DWORD BufferSize, - IN LPOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine); + IN LPOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine, + LPOVERLAPPED Overlapped); /* @@ -467,7 +475,8 @@ MMRESULT StartSoundThread( IN PSOUND_DEVICE_INSTANCE Instance, - IN SOUND_THREAD_REQUEST_HANDLER RequestHandler); + IN SOUND_THREAD_REQUEST_HANDLER RequestHandler, + IN PVOID Data); MMRESULT StopSoundThread( @@ -478,6 +487,11 @@ IN PSOUND_DEVICE_INSTANCE Instance, IN DWORD RequestId, IN PVOID RequestData); + +MMRESULT +GetSoundThreadPrivateData( + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, + OUT PVOID* PrivateData); Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/instances.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/instances.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/instances.c [iso-8859-1] Sun Jul 6 13:57:26 2008 @@ -31,6 +31,7 @@ SoundDeviceInstance->Next = NULL; SoundDeviceInstance->Device = NULL; SoundDeviceInstance->Thread = NULL; + /* TODO: WinMM callback entry */ } PSOUND_DEVICE_INSTANCE Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/kernel.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/kernel.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/kernel.c [iso-8859-1] Sun Jul 6 13:57:26 2008 @@ -212,13 +212,12 @@ PSOUND_DEVICE_INSTANCE SoundDeviceInstance, LPVOID Buffer, DWORD BufferSize, - LPOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine) + LPOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine, + LPOVERLAPPED Overlapped) { WCHAR msg[128]; if ( ( ! SoundDeviceInstance ) || ( ! Buffer ) || ( BufferSize == 0 ) ) return MMSYSERR_INVALPARAM; - - ZeroMemory(&SoundDeviceInstance->Overlapped, sizeof(OVERLAPPED)); wsprintf(msg, L"Writing to handle %x", SoundDeviceInstance->Device->Handle); SOUND_DEBUG(msg); @@ -226,7 +225,7 @@ if ( ! WriteFileEx(SoundDeviceInstance->Device->Handle, Buffer, BufferSize, - &SoundDeviceInstance->Overlapped, + Overlapped, CompletionRoutine) ) { wsprintf(msg, L"Win32 Error %d", GetLastError()); Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/mme/wodMessage.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/mme/wodMessage.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/mme/wodMessage.c [iso-8859-1] Sun Jul 6 13:57:26 2008 @@ -124,6 +124,8 @@ Result = DestroySoundDeviceInstance(Instance); SOUND_DEBUG_HEX(Result); + /* TODO: When do we send the callback? */ + return Result; /* CloseSoundDevice() */ } Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/thread.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/thread.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/thread.c [iso-8859-1] Sun Jul 6 13:57:26 2008 @@ -59,6 +59,7 @@ /* Do the work (request 0 kills the thread) */ Thread->Request.Result = Thread->RequestHandler(Instance, + Thread->PrivateData, Thread->Request.RequestId, Thread->Request.Data); @@ -139,7 +140,8 @@ MMRESULT StartSoundThread( IN PSOUND_DEVICE_INSTANCE Instance, - IN SOUND_THREAD_REQUEST_HANDLER RequestHandler) + IN SOUND_THREAD_REQUEST_HANDLER RequestHandler, + IN LPVOID PrivateThreadData) { PSOUND_THREAD SoundThread = NULL; @@ -161,6 +163,7 @@ return MMSYSERR_NOMEM; /* Initialise */ + SoundThread->PrivateData = PrivateThreadData; SoundThread->Running = FALSE; SoundThread->Handle = INVALID_HANDLE_VALUE; SoundThread->RequestHandler = RequestHandler; @@ -239,35 +242,54 @@ MMRESULT CallSoundThread( - IN PSOUND_DEVICE_INSTANCE Instance, + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, IN DWORD RequestId, IN PVOID RequestData) { MMRESULT Result; - if ( ! Instance ) - return MMSYSERR_INVALPARAM; - - if ( ! Instance->Thread ) + if ( ! SoundDeviceInstance ) + return MMSYSERR_INVALPARAM; + + if ( ! SoundDeviceInstance->Thread ) return MMSYSERR_ERROR; /* Wait for the thread to be ready */ - WaitForSingleObject(Instance->Thread->ReadyEvent, INFINITE); + WaitForSingleObject(SoundDeviceInstance->Thread->ReadyEvent, INFINITE); /* Load the request */ - Instance->Thread->Request.DeviceInstance = Instance; - Instance->Thread->Request.RequestId = RequestId; - Instance->Thread->Request.Data = RequestData; - Instance->Thread->Request.Result = MMSYSERR_NOTSUPPORTED; + SoundDeviceInstance->Thread->Request.DeviceInstance = SoundDeviceInstance; + SoundDeviceInstance->Thread->Request.RequestId = RequestId; + SoundDeviceInstance->Thread->Request.Data = RequestData; + SoundDeviceInstance->Thread->Request.Result = MMSYSERR_NOTSUPPORTED; /* Notify the thread that there's a request to be processed */ - SetEvent(Instance->Thread->RequestEvent); + SetEvent(SoundDeviceInstance->Thread->RequestEvent); /* Wait for the thread to be ready (request complete) */ - WaitForSingleObject(Instance->Thread->DoneEvent, INFINITE); + WaitForSingleObject(SoundDeviceInstance->Thread->DoneEvent, INFINITE); /* Grab the result */ - Result = Instance->Thread->Request.Result; + Result = SoundDeviceInstance->Thread->Request.Result; return Result; } + +MMRESULT +GetSoundThreadPrivateData( + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, + OUT PVOID* PrivateData) +{ + if ( ! SoundDeviceInstance ) + return MMSYSERR_INVALPARAM; + + if ( ! SoundDeviceInstance->Thread ) + return MMSYSERR_ERROR; + + if ( ! PrivateData ) + return MMSYSERR_INVALPARAM; + + *PrivateData = SoundDeviceInstance->Thread->PrivateData; + + return MMSYSERR_NOERROR; +} Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wavethread.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wavethread.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wavethread.c [iso-8859-1] Sun Jul 6 13:57:26 2008 @@ -19,6 +19,14 @@ #include <mmsystem.h> #include <mmebuddy.h> + +MMRESULT +WriteWaveBufferToSoundDevice( + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, + IN PWAVE_THREAD_DATA ThreadData, + IN PWAVEHDR WaveHeader); + + VOID CALLBACK WaveBufferCompleted( @@ -26,47 +34,91 @@ IN DWORD dwNumberOfBytesTransferred, IN LPOVERLAPPED lpOverlapped) { - MessageBox(0, L"Job done!", L"File IO Callback", MB_OK | MB_TASKMODAL); -} + PWAVE_OVERLAPPED WaveOverlapped = (PWAVE_OVERLAPPED) lpOverlapped; + /*PWAVE_THREAD_DATA ThreadData = WaveOverlapped->ThreadData;*/ + WCHAR msg[1024]; + + wsprintf(msg, L"Buffer %x done\nWrote %d bytes\nErrCode %d", + WaveOverlapped->Header, + dwNumberOfBytesTransferred, + dwErrorCode); + + MessageBox(0, msg, L"File IO Callback", MB_OK | MB_TASKMODAL); + + WriteWaveBufferToSoundDevice(WaveOverlapped->SoundDeviceInstance, + WaveOverlapped->ThreadData, + WaveOverlapped->Header); +} + +MMRESULT +WriteWaveBufferToSoundDevice( + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, + IN PWAVE_THREAD_DATA ThreadData, + IN PWAVEHDR WaveHeader) +{ + SOUND_ASSERT(SoundDeviceInstance); + SOUND_ASSERT(ThreadData); + SOUND_ASSERT(WaveHeader); + + /* Prepare our overlapped data */ + ZeroMemory(&ThreadData->Overlapped, sizeof(WAVE_OVERLAPPED)); + ThreadData->Overlapped.SoundDeviceInstance = SoundDeviceInstance; + ThreadData->Overlapped.ThreadData = ThreadData; + ThreadData->Overlapped.Header = WaveHeader; + + return WriteSoundDeviceBuffer(SoundDeviceInstance, + WaveHeader->lpData, + WaveHeader->dwBufferLength, + WaveBufferCompleted, + (LPOVERLAPPED) &ThreadData->Overlapped); +} + /* Internal dispatch routines */ MMRESULT SubmitWaveBuffer( IN PSOUND_DEVICE_INSTANCE Instance, + IN PWAVE_THREAD_DATA ThreadData, IN PWAVEHDR Buffer) { - MMRESULT Result; - SOUND_ASSERT(Instance != NULL); SOUND_ASSERT(Buffer != NULL); + SOUND_ASSERT(Instance->Thread != NULL); + + /* Store the device instance */ + Buffer->reserved = (DWORD) Instance; /* Set the head of the buffer list if this is the first buffer */ - if ( ! Instance->Wave.FirstBuffer ) - { - Instance->Wave.FirstBuffer = Buffer; + if ( ! ThreadData->FirstBuffer ) + { + ThreadData->FirstBuffer = Buffer; } /* Attach the buffer to the end of the list, unless this is the first */ - if ( Instance->Wave.LastBuffer ) - { - Instance->Wave.LastBuffer->lpNext = Buffer; + if ( ThreadData->LastBuffer ) + { + ThreadData->LastBuffer->lpNext = Buffer; } /* Update our record of the last buffer */ - Instance->Wave.LastBuffer = Buffer; + ThreadData->LastBuffer = Buffer; /* Increment the number of buffers queued */ - ++ Instance->Wave.BufferCount; + ++ ThreadData->BufferCount; /* HACK */ - Instance->Wave.CurrentBuffer = Instance->Wave.FirstBuffer; - + ThreadData->CurrentBuffer = ThreadData->FirstBuffer; + + WriteWaveBufferToSoundDevice(Instance, ThreadData, Buffer); + +/* Result = WriteSoundDeviceBuffer(Instance, - Instance->Wave.CurrentBuffer->lpData, - Instance->Wave.CurrentBuffer->dwBufferLength, - WaveBufferCompleted); - + ThreadData->CurrentBuffer->lpData, + ThreadData->CurrentBuffer->dwBufferLength, + WaveBufferCompleted, + (LPOVERLAPPED) &Thread->Wave.Overlapped); +*/ return MMSYSERR_NOERROR; } @@ -76,9 +128,13 @@ MMRESULT ProcessWaveThreadRequest( IN PSOUND_DEVICE_INSTANCE Instance, + IN PVOID PrivateThreadData, IN DWORD RequestId, IN PVOID Data) { + PWAVE_THREAD_DATA WaveThreadData = + (PWAVE_THREAD_DATA) PrivateThreadData; + /* Just some temporary testing code for now */ WCHAR msg[128]; wsprintf(msg, L"Request %d received", RequestId); @@ -93,7 +149,7 @@ { PWAVEHDR Buffer = (PWAVEHDR) Data; - return SubmitWaveBuffer(Instance, Buffer); + return SubmitWaveBuffer(Instance, WaveThreadData, Buffer); } } @@ -105,20 +161,30 @@ IN PSOUND_DEVICE_INSTANCE Instance) { MMRESULT Result = MMSYSERR_NOERROR; + PWAVE_THREAD_DATA WaveThreadData = NULL; if ( ! Instance ) return MMSYSERR_INVALPARAM; + WaveThreadData = AllocateMemoryFor(WAVE_THREAD_DATA); + + if ( ! WaveThreadData ) + return MMSYSERR_NOMEM; + /* Initialise our data */ - Instance->Wave.CurrentBuffer = NULL; - Instance->Wave.FirstBuffer = NULL; - Instance->Wave.LastBuffer = NULL; - Instance->Wave.BufferCount = 0; + WaveThreadData->CurrentBuffer = NULL; + WaveThreadData->FirstBuffer = NULL; + WaveThreadData->LastBuffer = NULL; + WaveThreadData->BufferCount = 0; + /* TODO: More */ /* Kick off the thread */ - Result = StartSoundThread(Instance, ProcessWaveThreadRequest); + Result = StartSoundThread(Instance, + ProcessWaveThreadRequest, + WaveThreadData); if ( Result != MMSYSERR_NOERROR ) { + FreeMemory(WaveThreadData); return Result; } @@ -130,8 +196,20 @@ StopWaveThread( IN PSOUND_DEVICE_INSTANCE Instance) { + MMRESULT Result; + PWAVE_THREAD_DATA WaveThreadData = NULL; + if ( ! Instance ) return MMSYSERR_INVALPARAM; - return StopSoundThread(Instance); -} + Result = GetSoundThreadPrivateData(Instance, (PVOID*) &WaveThreadData); + SOUND_ASSERT( Result == MMSYSERR_NOERROR ); + + /* This shouldn't fail... */ + Result = StopSoundThread(Instance); + SOUND_ASSERT( Result == MMSYSERR_NOERROR ); + + FreeMemory(WaveThreadData); + + return MMSYSERR_NOERROR; +}
16 years, 5 months
1
0
0
0
← Newer
1
...
62
63
64
65
66
67
68
...
77
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
68
69
70
71
72
73
74
75
76
77
Results per page:
10
25
50
100
200