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
June
May
April
March
February
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
September 2005
----- 2025 -----
June 2025
May 2025
April 2025
March 2025
February 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
22 participants
582 discussions
Start a n
N
ew thread
[npwoods] 18131: Notepad enhancements:
by npwoods@svn.reactos.com
Notepad enhancements: 1. Removed the 30k limit 2. Implemented Replace and Replace All Modified: trunk/reactos/subsys/system/notepad/main.c _____ Modified: trunk/reactos/subsys/system/notepad/main.c --- trunk/reactos/subsys/system/notepad/main.c 2005-09-27 21:49:18 UTC (rev 18130) +++ trunk/reactos/subsys/system/notepad/main.c 2005-09-27 23:29:35 UTC (rev 18131) @@ -102,13 +102,14 @@ * NOTEPAD_FindNext */ -static VOID NOTEPAD_FindNext(FINDREPLACE *pFindReplace) +static
…
[View More]
BOOL NOTEPAD_FindNext(FINDREPLACE *pFindReplace, BOOL bShowAlert) { int iTextLength, iTargetLength; LPTSTR pszText = NULL; DWORD dwPosition, dwDummy; BOOL bMatches = FALSE; TCHAR szResource[128], szText[128]; + BOOL bSuccess; iTargetLength = _tcslen(pFindReplace->lpstrFindWhat); @@ -118,7 +119,7 @@ { pszText = (LPTSTR) HeapAlloc(GetProcessHeap(), 0, (iTextLength + 1) * sizeof(TCHAR)); if (!pszText) - return; + return FALSE; GetWindowText(Globals.hEdit, pszText, iTextLength + 1); } @@ -155,22 +156,57 @@ /* Found target */ SendMessage(Globals.hEdit, EM_SETSEL, dwPosition, dwPosition + iTargetLength); SendMessage(Globals.hEdit, EM_SCROLLCARET, 0, 0); + bSuccess = TRUE; } else { /* Can't find target */ - LoadString(Globals.hInstance, STRING_CANNOTFIND, szResource, SIZEOF(szResource)); - _sntprintf(szText, SIZEOF(szText), szResource, pFindReplace->lpstrFindWhat); - LoadString(Globals.hInstance, STRING_NOTEPAD, szResource, SIZEOF(szResource)); - MessageBox(Globals.hEdit, szText, szResource, MB_OK); + if (bShowAlert) + { + LoadString(Globals.hInstance, STRING_CANNOTFIND, szResource, SIZEOF(szResource)); + _sntprintf(szText, SIZEOF(szText), szResource, pFindReplace->lpstrFindWhat); + LoadString(Globals.hInstance, STRING_NOTEPAD, szResource, SIZEOF(szResource)); + MessageBox(Globals.hEdit, szText, szResource, MB_OK); + } + bSuccess = FALSE; } if (pszText) HeapFree(GetProcessHeap(), 0, pszText); + return bSuccess; } /*********************************************************************** * + * NOTEPAD_Replace + */ + +static VOID NOTEPAD_Replace(FINDREPLACE *pFindReplace) +{ + if (NOTEPAD_FindNext(pFindReplace, TRUE)) + SendMessage(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM) pFindReplace->lpstrReplaceWith); +} + +/********************************************************************** * + * + * NOTEPAD_ReplaceAll + */ + +static VOID NOTEPAD_ReplaceAll(FINDREPLACE *pFindReplace) +{ + BOOL bShowAlert = TRUE; + + SendMessage(Globals.hEdit, EM_SETSEL, 0, 0); + + while (NOTEPAD_FindNext(pFindReplace, bShowAlert)) + { + SendMessage(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM) pFindReplace->lpstrReplaceWith); + bShowAlert = FALSE; + } +} + +/********************************************************************** * + * * NOTEPAD_FindTerm */ @@ -237,6 +273,9 @@ Globals.hEdit = CreateWindowEx(EDIT_EXSTYLE, editW, NULL, EDIT_STYLE, 0, 0, rc.right, rc.bottom, hWnd, NULL, Globals.hInstance, NULL); + if (!Globals.hEdit) + return -1; + SendMessage(Globals.hEdit, EM_LIMITTEXT, 0, 0); break; } @@ -294,7 +333,11 @@ FINDREPLACE *pFindReplace = (FINDREPLACE *) lParam; if (pFindReplace->Flags & FR_FINDNEXT) - NOTEPAD_FindNext(pFindReplace); + NOTEPAD_FindNext(pFindReplace, TRUE); + else if (pFindReplace->Flags & FR_REPLACE) + NOTEPAD_Replace(pFindReplace); + else if (pFindReplace->Flags & FR_REPLACEALL) + NOTEPAD_ReplaceAll(pFindReplace); else if (pFindReplace->Flags & FR_DIALOGTERM) NOTEPAD_FindTerm(); break;
[View Less]
19 years, 8 months
1
0
0
0
[greatlrd] 18130: - Fix move for readonly folder and file. for now it is a small hack for readonly folders, Small Cleanup in the code, thx w3seek for the help with SetFileAttribs code.
by greatlrd@svn.reactos.com
- Fix move for readonly folder and file. for now it is a small hack for readonly folders, Small Cleanup in the code, thx w3seek for the help with SetFileAttribs code. Modified: trunk/reactos/lib/kernel32/file/move.c _____ Modified: trunk/reactos/lib/kernel32/file/move.c --- trunk/reactos/lib/kernel32/file/move.c 2005-09-27 21:44:24 UTC (rev 18129) +++ trunk/reactos/lib/kernel32/file/move.c 2005-09-27 21:49:18 UTC (rev 18130) @@ -21,6 +21,19 @@ /* GLOBALS **********************************
…
[View More]
*******************************/ /* FUNCTIONS ****************************************************************/ +static BOOL +RemoveReadOnlyAttributeW(IN LPCWSTR lpFileName) +{ + DWORD Attributes; + Attributes = GetFileAttributesW(lpFileName); + if (Attributes != INVALID_FILE_ATTRIBUTES) + { + return SetFileAttributesW(lpFileName,Attributes - + (Attributes & ~FILE_ATTRIBUTE_READONLY)); + } + + return FALSE; +} static BOOL AdjustFileAttributes ( @@ -478,26 +491,15 @@ { FindClose(hFile); - /* delete folder */ + /* delete folder */ + DPRINT("MoveFileWithProgressW : folder : %s\n",lpDeleteFile); - size = GetFullPathNameW(lpExistingFileName2, MAX_PATH,(LPWSTR) lpDeleteFile, NULL); - if (size>MAX_PATH) - { - lpDeleteFile = (LPCWSTR) HeapReAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY, - (VOID *) lpDeleteFile,size); - if (lpDeleteFile == NULL) - { - Result = FALSE; - goto FreeMemAndExit; - } + Result = RemoveReadOnlyAttributeW(lpExistingFileName2); + if (Result == FALSE) + break; - GetFullPathNameW(lpExistingFileName2, size,(LPWSTR) lpDeleteFile, NULL); - } - - DPRINT("MoveFileWithProgressW : folder : %s\n",lpDeleteFile); - - Result = RemoveDirectoryW(lpDeleteFile); + Result = RemoveDirectoryW(lpExistingFileName2); if (Result == FALSE) break; @@ -547,7 +549,18 @@ } } - wcscpy( (WCHAR *)&lpExistingFileName2[size2-3],findBuffer.cFileName); + wcscpy( (WCHAR *)&lpExistingFileName2[size2-3],findBuffer.cFileName); + + + /* FIXME + * RemoveReadOnlyAttributeW(lpExistingFileName2); is a hack + * for to move readonly folders + */ + wcscpy( (WCHAR *)&lpExistingFileName2[size2+size-3],L"\0"); + RemoveReadOnlyAttributeW(lpExistingFileName2); + + + /* Continue */ wcscpy( (WCHAR *)&lpExistingFileName2[size2+size-3],L"\\*.*\0"); @@ -651,6 +664,10 @@ DPRINT("MoveFileWithProgressW : Delete file : %S : %S\n",lpDeleteFile, lpNewFileName2); + Result = RemoveReadOnlyAttributeW(lpDeleteFile); + if (Result == FALSE) + break; + Result = DeleteFileW(lpDeleteFile); if (Result == FALSE) {
[View Less]
19 years, 8 months
1
0
0
0
[gedmurphy] 18129: Start to implement the beginneings of tcpsvcs.exe. Just ideas at the moment, subject to change.
by gedmurphy@svn.reactos.com
Start to implement the beginneings of tcpsvcs.exe. Just ideas at the moment, subject to change. Working code for basic echo and chargen included. Tested in Windows from both Windows and Linux clients Run from cmd, not incorporated into services.exe at the moment Builds ok, but not included into build system just yet. Added: trunk/reactos/apps/utils/net/tcpsvcs/ Added: trunk/reactos/apps/utils/net/tcpsvcs/chargen/ Added: trunk/reactos/apps/utils/net/tcpsvcs/chargen/chargen.c Added: trunk/reactos/
…
[View More]
apps/utils/net/tcpsvcs/chargen/chargen.h Added: trunk/reactos/apps/utils/net/tcpsvcs/chargen/chargen.xml Added: trunk/reactos/apps/utils/net/tcpsvcs/daytime/ Added: trunk/reactos/apps/utils/net/tcpsvcs/discard/ Added: trunk/reactos/apps/utils/net/tcpsvcs/echo/ Added: trunk/reactos/apps/utils/net/tcpsvcs/echo/echo.c Added: trunk/reactos/apps/utils/net/tcpsvcs/echo/echo.h Added: trunk/reactos/apps/utils/net/tcpsvcs/qotd/ Added: trunk/reactos/apps/utils/net/tcpsvcs/skelserver/ Added: trunk/reactos/apps/utils/net/tcpsvcs/skelserver/skelserver.c Added: trunk/reactos/apps/utils/net/tcpsvcs/skelserver/skelserver.h Added: trunk/reactos/apps/utils/net/tcpsvcs/tcpsvcs.c Added: trunk/reactos/apps/utils/net/tcpsvcs/tcpsvcs.h Added: trunk/reactos/apps/utils/net/tcpsvcs/tcpsvcs.xml _____ Added: trunk/reactos/apps/utils/net/tcpsvcs/chargen/chargen.c --- trunk/reactos/apps/utils/net/tcpsvcs/chargen/chargen.c 2005-09-27 20:22:25 UTC (rev 18128) +++ trunk/reactos/apps/utils/net/tcpsvcs/chargen/chargen.c 2005-09-27 21:44:24 UTC (rev 18129) @@ -0,0 +1,104 @@ +#include <stdio.h> +#include <winsock2.h> +#include <tchar.h> +#include "chargen.h" +#include "../skelserver/skelserver.h" + +DWORD WINAPI ChargenHandler(VOID* Sock_) +{ + DWORD Retval = 0; + SOCKET Sock = (SOCKET)Sock_; + + if (!GenerateChars(Sock)) { + _tprintf(_T("Echo incoming packets failed\n")); + Retval = 3; + } + + _tprintf(_T("Shutting connection down...\n")); + if (ShutdownConnection(Sock)) { + _tprintf(_T("Connection is down.\n")); + } + else + { + _tprintf(_T("Connection shutdown failed\n")); + Retval = 3; + } + + return Retval; +} + + +BOOL GenerateChars(SOCKET Sock) +{ + int i, + charIndex, /* internal loop */ + loopIndex; /* line loop */ + char ring[END-START]; + char *endring; + + /* fill ring with printable characters */ + for (charIndex=0, i=START; i<=END; charIndex++, i++) + ring[charIndex] = i; + /* establish the end character in the ring */ + endring = &ring[charIndex]; + + /* where we will start output from */ + loopIndex = 0; + + while (1) + { + /* if the loop index is equal to number of chars previously + * printed, start the loop from the beginning */ + if (loopIndex == END-START) + loopIndex = 0; + + /* start printing from char controled by loopIndex */ + charIndex = loopIndex; + for (i=0; i<LINESIZ; i++) + { + SendChar(Sock, ring[charIndex]); + /* if current char equal last char, reset */ + if (ring[charIndex] == *endring) + charIndex = 0; + else + charIndex++; + } + SendChar(Sock, L'\r'); + SendChar(Sock, L'\n'); + + /* increment loop index to start printing from next char in ring */ + loopIndex++; + } + + return 0; +} + +BOOL SendChar(SOCKET Sock, TCHAR c) +{ + INT Temp; + INT SentBytes; + + SentBytes = 0; + Temp = send(Sock, &c, sizeof(TCHAR), 0); + if (Temp > 0) { + SentBytes += Temp; + } + else if (Temp == SOCKET_ERROR) { + return FALSE; + } + else + { + /* Client closed connection before we could reply to + all the data it sent, so quit early. */ + _tprintf(_T("Peer unexpectedly dropped connection!\n")); + return FALSE; + } + + _tprintf(("Connection closed by peer.\n")); + return TRUE; +} + + + + + _____ Added: trunk/reactos/apps/utils/net/tcpsvcs/chargen/chargen.h --- trunk/reactos/apps/utils/net/tcpsvcs/chargen/chargen.h 2005-09-27 20:22:25 UTC (rev 18128) +++ trunk/reactos/apps/utils/net/tcpsvcs/chargen/chargen.h 2005-09-27 21:44:24 UTC (rev 18129) @@ -0,0 +1,8 @@ +#define START 32 +#define END 126 +#define LINESIZ 72 +#define BUF 1024 + +DWORD WINAPI ChargenHandler(VOID* Sock_); +BOOL GenerateChars(SOCKET Sock); +BOOL SendChar(SOCKET Sock, CHAR c); _____ Added: trunk/reactos/apps/utils/net/tcpsvcs/chargen/chargen.xml --- trunk/reactos/apps/utils/net/tcpsvcs/chargen/chargen.xml 2005-09-27 20:22:25 UTC (rev 18128) +++ trunk/reactos/apps/utils/net/tcpsvcs/chargen/chargen.xml 2005-09-27 21:44:24 UTC (rev 18129) @@ -0,0 +1,9 @@ +<module name="chargen" type="win32cui" installbase="system32" installname="chargen.exe"> + <include base="arp">.</include> + <define name="__USE_W32API" /> + <library>kernel32</library> + <library>iphlpapi</library> + <library>ws2_32</library> + <file>chargen/chargen.c</file> +</module> + _____ Added: trunk/reactos/apps/utils/net/tcpsvcs/echo/echo.c --- trunk/reactos/apps/utils/net/tcpsvcs/echo/echo.c 2005-09-27 20:22:25 UTC (rev 18128) +++ trunk/reactos/apps/utils/net/tcpsvcs/echo/echo.c 2005-09-27 21:44:24 UTC (rev 18129) @@ -0,0 +1,72 @@ +#include <stdio.h> +#include <winsock2.h> +#include <tchar.h> +#include "echo.h" +#include "../skelserver/skelserver.h" + +// Handles the incoming data by reflecting it back to the sender. +DWORD WINAPI EchoHandler(VOID* Sock_) +{ + DWORD Retval = 0; + SOCKET Sock = (SOCKET)Sock_; + + if (!EchoIncomingPackets(Sock)) { + _tprintf(_T("Echo incoming packets failed\n")); + Retval = 3; + } + + _tprintf(_T("Shutting connection down...\n")); + if (ShutdownConnection(Sock)) { + _tprintf(_T("Connection is down.\n")); + } + else + { + _tprintf(_T("Connection shutdown failed\n")); + Retval = 3; + } + + return Retval; +} + + + +BOOL EchoIncomingPackets(SOCKET Sock) +{ + TCHAR ReadBuffer[BUF]; + INT Temp; + INT ReadBytes; + INT SentBytes; + + do { + ReadBytes = recv(Sock, ReadBuffer, BUF, 0); + if (ReadBytes > 0) { + _tprintf(_T("Received %d bytes from client\n"), ReadBytes); + + SentBytes = 0; + while (SentBytes < ReadBytes) { + Temp = send(Sock, ReadBuffer + SentBytes, + ReadBytes - SentBytes, 0); + if (Temp > 0) { + _tprintf(_T("Sent %d bytes back to client\n"), Temp); + SentBytes += Temp; + } + else if (Temp == SOCKET_ERROR) { + return FALSE; + } + else { + /* Client closed connection before we could reply to + // all the data it sent, so quit early. */ + _tprintf(_T("Peer unexpectedly dropped connection!\n")); + return FALSE; + } + } + } + else if (ReadBytes == SOCKET_ERROR) { + return FALSE; + } + } while (ReadBytes != 0); + + _tprintf(("Connection closed by peer.\n")); + return TRUE; +} + _____ Added: trunk/reactos/apps/utils/net/tcpsvcs/echo/echo.h --- trunk/reactos/apps/utils/net/tcpsvcs/echo/echo.h 2005-09-27 20:22:25 UTC (rev 18128) +++ trunk/reactos/apps/utils/net/tcpsvcs/echo/echo.h 2005-09-27 21:44:24 UTC (rev 18129) @@ -0,0 +1,4 @@ +#define BUF 1024 + +DWORD WINAPI EchoHandler(VOID* Sock_); +BOOL EchoIncomingPackets(SOCKET Sock); _____ Added: trunk/reactos/apps/utils/net/tcpsvcs/skelserver/skelserver.c --- trunk/reactos/apps/utils/net/tcpsvcs/skelserver/skelserver.c 2005-09-27 20:22:25 UTC (rev 18128) +++ trunk/reactos/apps/utils/net/tcpsvcs/skelserver/skelserver.c 2005-09-27 21:44:24 UTC (rev 18129) @@ -0,0 +1,127 @@ +#include <stdio.h> +#include <winsock2.h> +#include <tchar.h> +#include "../tcpsvcs.h" +#include "skelserver.h" + + +DWORD WINAPI StartServer(LPVOID lpParam) +{ + const TCHAR* HostIP = "127.0.0.1"; + DWORD RetVal; + WSADATA wsaData; + PMYDATA pData; + + pData = (PMYDATA)lpParam; + + if ((RetVal = WSAStartup(MAKEWORD(2, 2), &wsaData)) != 0) + { + _tprintf(_T("WSAStartup() failed : %lu\n"), RetVal); + return -1; + } + + SOCKET ListeningSocket = SetUpListener(HostIP, htons(pData->Port)); + if (ListeningSocket == INVALID_SOCKET) + { + _tprintf(_T("error setting up socket\n")); + return 3; + } + + printf("Waiting for connections...\n"); + while (1) + { + AcceptConnections(ListeningSocket, pData->Service); + printf("Acceptor restarting...\n"); + } + + WSACleanup(); + return 0; +} + + +SOCKET SetUpListener(const char* ServAddr, int Port) +{ + SOCKET Sock; + SOCKADDR_IN Server; + DWORD InterfaceAddr = inet_addr(ServAddr); + + if (InterfaceAddr != INADDR_NONE) + { + Sock = socket(AF_INET, SOCK_STREAM, 0); + if (Sock != INVALID_SOCKET) + { + Server.sin_family = AF_INET; + Server.sin_addr.s_addr = InterfaceAddr; + Server.sin_port = Port; + if (bind(Sock, (SOCKADDR*)&Server, sizeof(SOCKADDR_IN)) != SOCKET_ERROR) + { + listen(Sock, SOMAXCONN); + return Sock; + } + else + printf("bind() failed\n"); + + } + } + return INVALID_SOCKET; +} + + + + +VOID AcceptConnections(SOCKET ListeningSocket, LPTHREAD_START_ROUTINE Service) +{ + SOCKADDR_IN Client; + SOCKET Sock; + INT nAddrSize = sizeof(Client); + DWORD ThreadID; + + while (1) + { + Sock = accept(ListeningSocket, (SOCKADDR*)&Client, &nAddrSize); + if (Sock != INVALID_SOCKET) + { + _tprintf(_T("Accepted connection from %s:%d\n"), + inet_ntoa(Client.sin_addr), ntohs(Client.sin_port)); + + CreateThread(0, 0, Service, (void*)Sock, 0, &ThreadID); + } + else + { + _tprintf(_T("accept() failed\n")); + return; + } + } +} + +BOOL ShutdownConnection(SOCKET Sock) +{ + /* Disallow any further data sends. This will tell the other side + that we want to go away now. If we skip this step, we don't + shut the connection down nicely. */ + if (shutdown(Sock, SD_SEND) == SOCKET_ERROR) + return FALSE; + + /* Receive any extra data still sitting on the socket. After all + data is received, this call will block until the remote host + acknowledges the TCP control packet sent by the shutdown above. + Then we'll get a 0 back from recv, signalling that the remote + host has closed its side of the connection. */ + while (1) + { + char ReadBuffer[BUF]; + int NewBytes = recv(Sock, ReadBuffer, BUF, 0); + if (NewBytes == SOCKET_ERROR) + return FALSE; + else if (NewBytes != 0) + _tprintf(_T("FYI, received %d unexpected bytes during shutdown\n"), NewBytes); + else + break; + } + + /* Close the socket. */ + if (closesocket(Sock) == SOCKET_ERROR) + return FALSE; + + return TRUE; +} _____ Added: trunk/reactos/apps/utils/net/tcpsvcs/skelserver/skelserver.h --- trunk/reactos/apps/utils/net/tcpsvcs/skelserver/skelserver.h 2005-09-27 20:22:25 UTC (rev 18128) +++ trunk/reactos/apps/utils/net/tcpsvcs/skelserver/skelserver.h 2005-09-27 21:44:24 UTC (rev 18129) @@ -0,0 +1,7 @@ +#define BUF 1024 + +DWORD WINAPI StartServer(LPVOID lpParam); +SOCKET SetUpListener(const char* ServAddr, int Port); +VOID AcceptConnections(SOCKET ListeningSocket, LPTHREAD_START_ROUTINE Service); +BOOL EchoIncomingPackets(SOCKET sd); +BOOL ShutdownConnection(SOCKET Sock); _____ Added: trunk/reactos/apps/utils/net/tcpsvcs/tcpsvcs.c --- trunk/reactos/apps/utils/net/tcpsvcs/tcpsvcs.c 2005-09-27 20:22:25 UTC (rev 18128) +++ trunk/reactos/apps/utils/net/tcpsvcs/tcpsvcs.c 2005-09-27 21:44:24 UTC (rev 18129) @@ -0,0 +1,57 @@ +#include <stdio.h> +#include <winsock2.h> +#include <tchar.h> +#include "tcpsvcs.h" +#include "skelserver/skelserver.h" +#include "echo/echo.h" +#include "chargen/chargen.h" + +int main(int argc, char *argv[]) +{ + PMYDATA pData[MAX_THREADS]; + DWORD dwThreadId[MAX_THREADS]; + HANDLE hThread[MAX_THREADS]; + INT i; + + /* Create MAX_THREADS worker threads. */ + for( i=0; i<MAX_THREADS; i++ ) + { + /* Allocate memory for thread data. */ + pData[i] = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MYDATA)); + + if( pData == NULL ) + ExitProcess(2); + + /* Generate unique data for each thread. */ + pData[0]->Port = ECHO_PORT; + pData[0]->Service = EchoHandler; + pData[1]->Port = CHARGEN_PORT; + pData[1]->Service = ChargenHandler; + + hThread[i] = CreateThread( + NULL, // default security attributes + 0, // use default stack size + StartServer, // thread function + pData[i], // argument to thread function + 0, // use default creation flags + &dwThreadId[i]); // returns the thread identifier + + /* Check the return value for success. */ + if (hThread[i] == NULL) + { + ExitProcess(i); + } + } + + /* Wait until all threads have terminated. */ + WaitForMultipleObjects(MAX_THREADS, hThread, TRUE, INFINITE); + + /* Close all thread handles upon completion. */ + for(i=0; i<MAX_THREADS; i++) + { + CloseHandle(hThread[i]); + } + + return 0; +} + _____ Added: trunk/reactos/apps/utils/net/tcpsvcs/tcpsvcs.h --- trunk/reactos/apps/utils/net/tcpsvcs/tcpsvcs.h 2005-09-27 20:22:25 UTC (rev 18128) +++ trunk/reactos/apps/utils/net/tcpsvcs/tcpsvcs.h 2005-09-27 21:44:24 UTC (rev 18129) @@ -0,0 +1,13 @@ +#define ECHO_PORT 7 +#define CHARGEN_PORT 19 +#define DAYTIME_PORT 13 +#define DISCARD_PORT 9 +#define QOTD_PORT 17 + +#define MAX_THREADS 2 +#define BUF_SIZE 255 + +typedef struct _MyData { + INT Port; + LPTHREAD_START_ROUTINE Service; +} MYDATA, *PMYDATA; _____ Added: trunk/reactos/apps/utils/net/tcpsvcs/tcpsvcs.xml --- trunk/reactos/apps/utils/net/tcpsvcs/tcpsvcs.xml 2005-09-27 20:22:25 UTC (rev 18128) +++ trunk/reactos/apps/utils/net/tcpsvcs/tcpsvcs.xml 2005-09-27 21:44:24 UTC (rev 18129) @@ -0,0 +1,13 @@ +<module name="tcpsvcs" type="win32cui" installbase="system32" installname="tcpsvcs.exe"> + <include base="arp">.</include> + <define name="__USE_W32API" /> + <library>kernel32</library> + <library>iphlpapi</library> + <library>ws2_32</library> + <library>shlwapi</library> + <file>tcpsvcs.c</file> + <file>skelserver/skelserver.c</file> + <file>echo/echo.c</file> + <file>chargen/chargen.c</file> +</module> +
[View Less]
19 years, 8 months
1
0
0
0
[weiden] 18128: some code reformatting of slayer.dll and make it build again
by weiden@svn.reactos.com
some code reformatting of slayer.dll and make it build again Modified: trunk/reactos/lib/directory.xml Added: trunk/reactos/lib/shellext/directory.xml Modified: trunk/reactos/lib/shellext/slayer/precomp.h Modified: trunk/reactos/lib/shellext/slayer/slayer.c Added: trunk/reactos/lib/shellext/slayer/slayer.xml _____ Modified: trunk/reactos/lib/directory.xml --- trunk/reactos/lib/directory.xml 2005-09-27 18:19:59 UTC (rev 18127) +++ trunk/reactos/lib/directory.xml 2005-09-27 20:22:25 UTC (rev
…
[View More]
18128) @@ -227,6 +227,9 @@ <directory name="shell32"> <xi:include href="shell32/shell32.xml" /> </directory> +<directory name="shellext"> + <xi:include href="shellext/directory.xml" /> +</directory> <directory name="shfolder"> <xi:include href="shfolder/shfolder.xml" /> </directory> _____ Added: trunk/reactos/lib/shellext/directory.xml --- trunk/reactos/lib/shellext/directory.xml 2005-09-27 18:19:59 UTC (rev 18127) +++ trunk/reactos/lib/shellext/directory.xml 2005-09-27 20:22:25 UTC (rev 18128) @@ -0,0 +1,3 @@ +<directory name="slayer"> + <xi:include href="slayer/slayer.xml" /> +</directory> \ No newline at end of file Property changes on: trunk/reactos/lib/shellext/directory.xml ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/reactos/lib/shellext/slayer ___________________________________________________________________ Name: svn:ignore - *.coff *.dll *.gch *.d *.a *.o *.sym *.map *.tmp + *.coff *.dll *.gch *.d *.a *.o *.sym *.map *.tmp GNUmakefile _____ Modified: trunk/reactos/lib/shellext/slayer/precomp.h --- trunk/reactos/lib/shellext/slayer/precomp.h 2005-09-27 18:19:59 UTC (rev 18127) +++ trunk/reactos/lib/shellext/slayer/precomp.h 2005-09-27 20:22:25 UTC (rev 18128) @@ -1,4 +1,3 @@ -#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */ #define INITGUID #include <windows.h> #include <commctrl.h> @@ -7,7 +6,6 @@ #include <stdlib.h> #include <stdio.h> #include <objbase.h> -#include <basetyps.h> #include <unknwn.h> #include "resource.h" #include "slayer.h" _____ Modified: trunk/reactos/lib/shellext/slayer/slayer.c --- trunk/reactos/lib/shellext/slayer/slayer.c 2005-09-27 18:19:59 UTC (rev 18127) +++ trunk/reactos/lib/shellext/slayer/slayer.c 2005-09-27 20:22:25 UTC (rev 18128) @@ -1,6 +1,6 @@ /* * ReactOS Compatibility Layer Shell Extension - * Copyright (C) 2004 ReactOS Team + * Copyright (C) 2004 - 2005 ReactOS Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -25,41 +25,41 @@ * UPDATE HISTORY: * 09/25/2004 Created */ -#include "precomp.h" +#include <precomp.h> HINSTANCE hInstance = NULL; LONG dllrefs = 0; /* FIXME - they should be exported somewhere instead of defined here... */ -DEFINE_SHLGUID(IID_IPropSheetPage, 0x000214F6L, 0, 0); -DEFINE_SHLGUID(IID_IShellPropSheetExt, 0x000214E9L, 0, 0); +DEFINE_GUID(IID_IClassFactory, 0x00000001, 0x0000, 0x0000, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46); +DEFINE_GUID(IID_IUnknown, 0x00000000, 0x0000, 0x0000, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46); static ifaceICompatibilityPageVbtl efvt = { - /* IUnknown methods */ - ICompatibilityPage_fnQueryInterface, - ICompatibilityPage_fnAddRef, - ICompatibilityPage_fnRelease, + /* IUnknown methods */ + ICompatibilityPage_fnQueryInterface, + ICompatibilityPage_fnAddRef, + ICompatibilityPage_fnRelease, }; static ifaceIShellPropSheetExtVbtl efvtIShellPropSheetExt = { - /* IShellPropSheetExt */ - ICompatibilityPage_fnAddPages, - ICompatibilityPage_fnReplacePage, + /* IShellPropSheetExt */ + ICompatibilityPage_fnAddPages, + ICompatibilityPage_fnReplacePage, }; static ifaceIShellExtInitVbtl efvtIShellExtInit = { - /* IShellExtInit */ - ICompatibilityPage_fnInitialize, + /* IShellExtInit */ + ICompatibilityPage_fnInitialize, }; static ifaceIClassFactoryVbtl efvtIClassFactory = { - /* IClassFactory */ - ICompatibilityPage_fnCreateInstance, - ICompatibilityPage_fnLockServer, + /* IClassFactory */ + ICompatibilityPage_fnCreateInstance, + ICompatibilityPage_fnLockServer, }; /*********************************************************************** ******* @@ -69,601 +69,756 @@ static VOID ClearCItemList(LPCOMPATIBILITYPAGE info) { - PCITEM item, next; + PCITEM item, next; - for(item = info->CItems; - item != NULL; - item = next) - { - next = item->next; - HeapFree(GetProcessHeap(), 0, item); - } + for (item = info->CItems; + item != NULL; + item = next) + { + next = item->next; + HeapFree(GetProcessHeap(), + 0, + item); + } - info->CSelectedItem = NULL; - info->CItems = NULL; - info->nItems = 0; + info->CSelectedItem = NULL; + info->CItems = NULL; + info->nItems = 0; } static BOOL -ReadDWORDFlag(HKEY hk, LPTSTR szValueName, LPDWORD lpOutValue, DWORD dwDefault) +ReadDWORDFlag(HKEY hk, + LPTSTR szValueName, + LPDWORD lpOutValue, + DWORD dwDefault) { - DWORD dwType, dwSize = sizeof(DWORD); - LONG e = RegQueryValueEx(hk, - szValueName, - 0, - &dwType, - (LPBYTE)lpOutValue, - &dwSize); + DWORD dwType, dwSize = sizeof(DWORD); + LONG e = RegQueryValueEx(hk, + szValueName, + 0, + &dwType, + (LPBYTE)lpOutValue, + &dwSize); - if(e != ERROR_SUCCESS || dwSize != sizeof(DWORD)) - { - *lpOutValue = dwDefault; + if (e != ERROR_SUCCESS || dwSize != sizeof(DWORD)) + { + *lpOutValue = dwDefault; - return TRUE; - } + return TRUE; + } - return FALSE; + return FALSE; } static BOOL -LoadAndParseAppCompatibilityFlags(LPCOMPATIBILITYPAGE info, LPTSTR szValueName) +LoadAndParseAppCompatibilityFlags(LPCOMPATIBILITYPAGE info, + LPTSTR szValueName) { - LONG e; - HKEY hk; - DWORD dwType, dwSize; - TCHAR szStr[256]; - - e = RegOpenKey(HKEY_CURRENT_USER, - TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers"), - &hk); - if(e == ERROR_SUCCESS) - { - dwSize = sizeof(szStr); - e = RegQueryValueEx(hk, - szValueName, - 0, - &dwType, - (LPBYTE)szStr, - &dwSize); - if(e == ERROR_SUCCESS) + LONG e; + HKEY hk; + DWORD dwType, dwSize; + TCHAR szStr[256]; + + e = RegOpenKey(HKEY_CURRENT_USER, + TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers"), + &hk); + if (e == ERROR_SUCCESS) { - /* FIXME - make sure the string is NULL-terminated! */ - TCHAR *c; - for(c = szStr; *c != TEXT('\0'); c++) - { - /* only the first word represents the compatibility mode */ - /* FIXME - parse all words! */ - if(*c == TEXT(' ')) + dwSize = sizeof(szStr); + + e = RegQueryValueEx(hk, + szValueName, + 0, + &dwType, + (LPBYTE)szStr, + &dwSize); + + if (e == ERROR_SUCCESS) { - *c = TEXT('\0'); - break; + /* FIXME - make sure the string is NULL-terminated! */ + TCHAR *c; + for (c = szStr; + *c != TEXT('\0'); + c++) + { + /* only the first word represents the compatibility mode */ + /* FIXME - parse all words! */ + if (*c == TEXT(' ')) + { + *c = TEXT('\0'); + break; + } + } + + info->CSelectedItem = NULL; + if (_tcslen(szStr) > 0) + { + PCITEM item; + + for (item = info->CItems; + item != NULL; + item = item->next) + { + if (!_tcsicmp(szStr, item->szKeyName)) + { + info->CSelectedItem = item; + break; + } + } + } } - } - - info->CSelectedItem = NULL; - if(_tcslen(szStr) > 0) - { - PCITEM item; - - for(item = info->CItems; item != NULL; item = item->next) - { - if(!_tcsicmp(szStr, item->szKeyName)) - { - info->CSelectedItem = item; - break; - } - } - } + RegCloseKey(hk); } - RegCloseKey(hk); - } - return FALSE; + return FALSE; } static BOOL LoadCompatibilityModes(LPCOMPATIBILITYPAGE info) { - BOOL Ret; - LONG e; - HKEY hk, hk2; - TCHAR szKey[256]; + BOOL Ret; + LONG e; + HKEY hk, hk2; + TCHAR szKey[256]; - ClearCItemList(info); - - e = RegOpenKey(HKEY_CURRENT_USER, - TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers"), - &hk); - if(e == ERROR_SUCCESS) - { - DWORD i; - PCITEM lastitem = NULL; - - for(i = 0; - (RegEnumKey(hk, i,szKey, sizeof(szKey) / sizeof(szKey[0])) == ERROR_SUCCESS); - i++) + ClearCItemList(info); + + e = RegOpenKey(HKEY_CURRENT_USER, + TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers"), + &hk); + + if (e == ERROR_SUCCESS) { - e = RegOpenKey(hk, - szKey, - &hk2); - if(e == ERROR_SUCCESS) - { - DWORD dwType; - - e = RegQueryValueEx(hk2, - NULL, - 0, - &dwType, - NULL, - NULL); - if(e != ERROR_SUCCESS || (e == ERROR_SUCCESS && dwType == REG_SZ)) + DWORD i; + PCITEM lastitem = NULL; + + for(i = 0; + (RegEnumKey(hk, i,szKey, sizeof(szKey) / sizeof(szKey[0])) == ERROR_SUCCESS); + i++) { - PCITEM item; - - item = HeapAlloc(GetProcessHeap(), 0, sizeof(CITEM)); - if(item != NULL) - { - DWORD cdb = sizeof(item->szName); - - /* description */ - e = RegQueryValueEx(hk2, - NULL, - 0, - NULL, - (LPBYTE)item->szName, - &cdb); + e = RegOpenKey(hk, + szKey, + &hk2); - /* make sure it is null-terminated */ - if(cdb > sizeof(item->szName) - sizeof(item->szName[0])) + if (e == ERROR_SUCCESS) { - item->szName[(sizeof(item->szName) / sizeof(item->szName[0])) - 1] = TEXT('\0'); + DWORD dwType; + + e = RegQueryValueEx(hk2, + NULL, + 0, + &dwType, + NULL, + NULL); + + if (e != ERROR_SUCCESS || (e == ERROR_SUCCESS && dwType == REG_SZ)) + { + PCITEM item; + + item = HeapAlloc(GetProcessHeap(), + 0, + sizeof(CITEM)); + if (item != NULL) + { + DWORD cdb = sizeof(item->szName); + + /* description */ + e = RegQueryValueEx(hk2, + NULL, + 0, + NULL, + (LPBYTE)item->szName, + &cdb); + + /* make sure it is null-terminated */ + if (cdb > sizeof(item->szName) - sizeof(item->szName[0])) + { + item->szName[(sizeof(item->szName) / sizeof(item->szName[0])) - 1] = TEXT('\0'); + } + + if (e != ERROR_SUCCESS || + cdb < sizeof(item->szName[0])) + { + _tcscpy(item->szName, szKey); + e = ERROR_SUCCESS; + } + + _tcscpy(item->szKeyName, szKey); + info->nItems++; + + ReadDWORDFlag(hk2, + TEXT("MajorVersion"), + &item->MajorVersion, + 0); + ReadDWORDFlag(hk2, + TEXT("MinorVersion"), + &item->MinorVersion, + 0); + ReadDWORDFlag(hk2, + TEXT("BuildNumber"), + &item->BuildNumber, + 0); + ReadDWORDFlag(hk2, + TEXT("PlatformId"), + &item->PlatformId, + 0); + ReadDWORDFlag(hk2, + TEXT("SPMajorVersion"), + &item->SPMajorVersion, + 0); + ReadDWORDFlag(hk2, + TEXT("SPMinorVersion"), + &item->SPMinorVersion, + 0); + + if (e == ERROR_SUCCESS) + { + item->next = NULL; + if (lastitem != NULL) + { + lastitem->next = item; + } + else + { + info->CItems = item; + } + lastitem = item; + } + else + { + HeapFree(GetProcessHeap(), + 0, + item); + } + } + } + + RegCloseKey(hk2); } - if(e != ERROR_SUCCESS || - cdb < sizeof(item->szName[0])) - { - _tcscpy(item->szName, szKey); - e = ERROR_SUCCESS; - } - _tcscpy(item->szKeyName, szKey); - info->nItems++; - ReadDWORDFlag(hk2, TEXT("MajorVersion"), &item->MajorVersion, 0); - ReadDWORDFlag(hk2, TEXT("MinorVersion"), &item->MinorVersion, 0); - ReadDWORDFlag(hk2, TEXT("BuildNumber"), &item->BuildNumber, 0); - ReadDWORDFlag(hk2, TEXT("PlatformId"), &item->PlatformId, 0); - ReadDWORDFlag(hk2, TEXT("SPMajorVersion"), &item->SPMajorVersion, 0); - ReadDWORDFlag(hk2, TEXT("SPMinorVersion"), &item->SPMinorVersion, 0); - - if(e == ERROR_SUCCESS) + if (e != ERROR_SUCCESS) { - item->next = NULL; - if(lastitem != NULL) - { - lastitem->next = item; - } - else - { - info->CItems = item; - } - lastitem = item; + e = ERROR_SUCCESS; } - else - { - HeapFree(GetProcessHeap(), 0, item); - } - } } - - RegCloseKey(hk2); - } - - if(e != ERROR_SUCCESS) - { - e = ERROR_SUCCESS; - } + RegCloseKey(hk); } - RegCloseKey(hk); - } - - Ret = ((e == ERROR_SUCCESS || e == ERROR_NO_MORE_ITEMS) ? TRUE : FALSE); - - return Ret; + + Ret = ((e == ERROR_SUCCESS || e == ERROR_NO_MORE_ITEMS) ? TRUE : FALSE); + + return Ret; } static VOID -FillComboBoxWithCompatibilityModes(LPCOMPATIBILITYPAGE info, HWND hwndDlg, HWND hCombo, BOOL bSelectItem, BOOL bDisableControlsIfEmpty) +FillComboBoxWithCompatibilityModes(LPCOMPATIBILITYPAGE info, + HWND hwndDlg, + HWND hCombo, + BOOL bSelectItem, + BOOL bDisableControlsIfEmpty) { - PCITEM item; - int i = 0; - BOOL sel = FALSE; + PCITEM item; + int i = 0; + BOOL sel = FALSE; + + SendMessage(hCombo, + CB_RESETCONTENT, + 0, + 0); - SendMessage(hCombo, CB_RESETCONTENT, 0, 0); + for (item = info->CItems; + item != NULL; + item = item->next) + { + int iIndex = (int)SendMessage(hCombo, + CB_ADDSTRING, + 0, + (LPARAM)item->szName); + + if (item == info->CSelectedItem && bSelectItem) + { + SendMessage(hCombo, + CB_SETCURSEL, + (WPARAM)iIndex, + 0); + sel = TRUE; + } + i++; + } - for(item = info->CItems; item != NULL; item = item->next) - { - int iIndex = (int)SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM)item->szName); - if(item == info->CSelectedItem && bSelectItem) + if (!sel && bSelectItem && i > 0) { - SendMessage(hCombo, CB_SETCURSEL, (WPARAM)iIndex, 0); - sel = TRUE; + /* select the first item */ + SendMessage(hCombo, + CB_SETCURSEL, + 0, + 0); } - i++; - } - - if(!sel && bSelectItem && i > 0) - { - /* select the first item */ - SendMessage(hCombo, CB_SETCURSEL, 0, 0); - } - - if(bDisableControlsIfEmpty) - { - BOOL enable = (i > 0); - EnableWindow(GetDlgItem(hwndDlg, IDC_COMPATGROUP), enable); - EnableWindow(hCombo, (enable && sel)); - EnableWindow(GetDlgItem(hwndDlg, IDC_CHKRUNCOMPATIBILITY), enable); - CheckDlgButton(hwndDlg, IDC_CHKRUNCOMPATIBILITY, ((enable && sel) ? BST_CHECKED : BST_UNCHECKED)); - } + + if (bDisableControlsIfEmpty) + { + BOOL enable = (i > 0); + + EnableWindow(GetDlgItem(hwndDlg, + IDC_COMPATGROUP), + enable); + + EnableWindow(hCombo, + (enable && sel)); + + EnableWindow(GetDlgItem(hwndDlg, + IDC_CHKRUNCOMPATIBILITY), + enable); + + CheckDlgButton(hwndDlg, + IDC_CHKRUNCOMPATIBILITY, + ((enable && sel) ? BST_CHECKED : BST_UNCHECKED)); + } } static VOID -FillEditListBoxWithCompatibilityModes(LPCOMPATIBILITYPAGE info, HWND hwndDlg, HWND hListBox, BOOL bDisableControlsIfEmpty) +FillEditListBoxWithCompatibilityModes(LPCOMPATIBILITYPAGE info, + HWND hwndDlg, + HWND hListBox, + BOOL bDisableControlsIfEmpty) { - PCITEM item; - int i = 0; + PCITEM item; + int i; - SendMessage(hListBox, LB_RESETCONTENT, 0, 0); + SendMessage(hListBox, + LB_RESETCONTENT, + 0, + 0); - for(item = info->CItems; item != NULL; item = item->next) - { - SendMessage(hListBox, LB_ADDSTRING, 0, (LPARAM)item->szName); - i++; - } + for (item = info->CItems, i = 0; + item != NULL; + item = item->next, i++) + { + SendMessage(hListBox, + LB_ADDSTRING, + 0, + (LPARAM)item->szName); + } - if(bDisableControlsIfEmpty) - { - } + if (bDisableControlsIfEmpty) + { + } } -INT_PTR CALLBACK -EditCompatibilityModesProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +static INT_PTR CALLBACK +EditCompatibilityModesProc(HWND hwndDlg, + UINT uMsg, + WPARAM wParam, + LPARAM lParam) { - LPCOMPATIBILITYPAGE this; - - switch(uMsg) - { - case WM_COMMAND: + LPCOMPATIBILITYPAGE this; + + switch (uMsg) { - switch(LOWORD(wParam)) - { - case IDOK: - EndDialog(hwndDlg, IDOK); - break; + case WM_COMMAND: + { + switch(LOWORD(wParam)) + { + case IDOK: + EndDialog(hwndDlg, + IDOK); + break; - case IDCANCEL: - EndDialog(hwndDlg, IDCANCEL); - break; - } - break; + case IDCANCEL: + EndDialog(hwndDlg, + IDCANCEL); + break; + } + break; + } + + case WM_CLOSE: + { + EndDialog(hwndDlg, + IDCANCEL); + break; + } + + case WM_INITDIALOG: + { + HWND hList = GetDlgItem(hwndDlg, + IDC_COMPATIBILITYMODE); + + this = (LPCOMPATIBILITYPAGE)lParam; + SetWindowLongPtr(hwndDlg, + GWLP_USERDATA, + (LONG_PTR)this); + + FillEditListBoxWithCompatibilityModes(this, + hwndDlg, + hList, + FALSE); + break; + } } - case WM_CLOSE: - { - EndDialog(hwndDlg, IDCANCEL); - break; - } - case WM_INITDIALOG: - { - HWND hList = GetDlgItem(hwndDlg, IDC_COMPATIBILITYMODE); - this = (LPCOMPATIBILITYPAGE)lParam; - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)this); - FillEditListBoxWithCompatibilityModes(this, hwndDlg, hList, FALSE); - break; - } - } - return FALSE; + + return FALSE; } static VOID -InitializePage(LPCOMPATIBILITYPAGE this, HWND hwndDlg) +InitializePage(LPCOMPATIBILITYPAGE this, + HWND hwndDlg) { - HWND hList; - - LoadCompatibilityModes(this); + HWND hList; - /* initialize the controls */ - hList = GetDlgItem(hwndDlg, IDC_COMPATIBILITYMODE); - LoadAndParseAppCompatibilityFlags(this, this->szFile); - FillComboBoxWithCompatibilityModes(this, hwndDlg, hList, TRUE, TRUE); + LoadCompatibilityModes(this); + + /* initialize the controls */ + hList = GetDlgItem(hwndDlg, + IDC_COMPATIBILITYMODE); + + LoadAndParseAppCompatibilityFlags(this, + this->szFile); + FillComboBoxWithCompatibilityModes(this, + hwndDlg, + hList, + TRUE, + TRUE); } static VOID -ReportPropertyChange(LPCOMPATIBILITYPAGE this, HWND hwndDlg) +ReportPropertyChange(LPCOMPATIBILITYPAGE this, + HWND hwndDlg) { - this->Changed = TRUE; - SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0); + this->Changed = TRUE; + + SendMessage(GetParent(hwndDlg), + PSM_CHANGED, + (WPARAM)hwndDlg, + 0); } static BOOL -ComposeFlags(LPCOMPATIBILITYPAGE this, LPTSTR szFlags) +ComposeFlags(LPCOMPATIBILITYPAGE this, + LPTSTR szFlags) { - if(this->CSelectedItem != NULL) - { - _tcscpy(szFlags, this->CSelectedItem->szKeyName); - return TRUE; - } + if (this->CSelectedItem != NULL) + { + _tcscpy(szFlags, + this->CSelectedItem->szKeyName); + return TRUE; + } - return FALSE; + return FALSE; } static BOOL -ApplySettings(LPCOMPATIBILITYPAGE this, HWND hwndDlg) +ApplySettings(LPCOMPATIBILITYPAGE this, + HWND hwndDlg) { - HKEY hk; - LONG e; - TCHAR szFlags[256]; - BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_CHKRUNCOMPATIBILITY) == BST_CHECKED; + HKEY hk; + LONG e; + TCHAR szFlags[256]; + BOOL enabled = IsDlgButtonChecked(hwndDlg, + IDC_CHKRUNCOMPATIBILITY) == BST_CHECKED; - if(enabled) - { - HWND hCombo = GetDlgItem(hwndDlg, IDC_COMPATIBILITYMODE); - int index = (int)SendMessage(hCombo, CB_GETCURSEL, 0, 0); - if(index >= 0) + if (enabled) { - int i; - PCITEM sel = this->CItems; - - /* map the index to a CITEM structure */ - for(i = index; i > 0 && sel != NULL; i--) - { - sel = sel->next; - } + HWND hCombo = GetDlgItem(hwndDlg, + IDC_COMPATIBILITYMODE); + int index = (int)SendMessage(hCombo, + CB_GETCURSEL, + 0, + 0); + if (index >= 0) + { + int i; + PCITEM sel = this->CItems; - /* update the CSelectedItem member */ - this->CSelectedItem = sel; + /* map the index to a CITEM structure */ + for(i = index; + i > 0 && sel != NULL; + i--) + { + sel = sel->next; + } + + /* update the CSelectedItem member */ + this->CSelectedItem = sel; + } + else + enabled = FALSE; } - else - enabled = FALSE; - } - e = RegOpenKey(HKEY_CURRENT_USER, - TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers"), - &hk); - if(e == ERROR_SUCCESS) - { - if(!enabled) + e = RegOpenKey(HKEY_CURRENT_USER, + TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers"), + &hk); + if (e == ERROR_SUCCESS) { - /* FIXME - only delete if nothing else is selected! */ - e = RegDeleteValue(hk, this->szFile); + if (!enabled) + { + /* FIXME - only delete if nothing else is selected! */ + e = RegDeleteValue(hk, + this->szFile); + } + else + { + if (ComposeFlags(this, + szFlags)) + { + e = RegSetValueEx(hk, + this->szFile, + 0, + REG_SZ, + (LPBYTE)szFlags, + (_tcslen(szFlags) + 1) * sizeof(TCHAR)); + } + else + { + e = RegDeleteValue(hk, + this->szFile); + } + } + + RegCloseKey(hk); } - else - { - if(ComposeFlags(this, szFlags)) - { - e = RegSetValueEx(hk, - this->szFile, - 0, - REG_SZ, - (LPBYTE)szFlags, - (_tcslen(szFlags) + 1) * sizeof(TCHAR)); - } - else - { - e = RegDeleteValue(hk, this->szFile); - } - } - RegCloseKey(hk); - } - - this->Changed = FALSE; - return (e == ERROR_SUCCESS); + this->Changed = FALSE; + return (e == ERROR_SUCCESS); } -INT_PTR CALLBACK -CompatibilityPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +static INT_PTR CALLBACK +CompatibilityPageProc(HWND hwndDlg, + UINT uMsg, + WPARAM wParam, + LPARAM lParam) { - LPCOMPATIBILITYPAGE this = (LPCOMPATIBILITYPAGE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - - switch(uMsg) - { - case WM_COMMAND: + LPCOMPATIBILITYPAGE this = (LPCOMPATIBILITYPAGE)GetWindowLongPtr(hwndDlg, + GWLP_USERDATA); + + switch (uMsg) { - if(HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_COMPATIBILITYMODE) - { - ReportPropertyChange(this, hwndDlg); - } - else - { - switch(LOWORD(wParam)) + case WM_COMMAND: { - case IDC_CHKRUNCOMPATIBILITY: - { - HWND hList = GetDlgItem(hwndDlg, IDC_COMPATIBILITYMODE); - if(hList != NULL) + if (HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_COMPATIBILITYMODE) { - EnableWindow(hList, IsDlgButtonChecked(hwndDlg, IDC_CHKRUNCOMPATIBILITY) == BST_CHECKED); + ReportPropertyChange(this, + hwndDlg); } - /* fall through */ - } - case IDC_CHKRUNIN256COLORS: - case IDC_CHKRUNIN640480RES: - case IDC_CHKDISABLEVISUALTHEMES: [truncated at 1000 lines; 898 more skipped]
[View Less]
19 years, 8 months
1
0
0
0
[weiden] 18127: some code reformatting
by weiden@svn.reactos.com
some code reformatting Modified: trunk/reactos/lib/aclui/misc.c _____ Modified: trunk/reactos/lib/aclui/misc.c --- trunk/reactos/lib/aclui/misc.c 2005-09-27 15:50:49 UTC (rev 18126) +++ trunk/reactos/lib/aclui/misc.c 2005-09-27 18:19:59 UTC (rev 18127) @@ -1,6 +1,6 @@ /* * ReactOS Access Control List Editor - * Copyright (C) 2004 ReactOS Team + * Copyright (C) 2004-2005 ReactOS Team * * This library is free software; you can redistribute it and/or * modify it under the terms of
…
[View More]
the GNU Lesser General Public @@ -41,36 +41,36 @@ LengthOfStrResource(IN HINSTANCE hInst, IN UINT uID) { - HRSRC hrSrc; - HGLOBAL hRes; - LPWSTR lpName, lpStr; + HRSRC hrSrc; + HGLOBAL hRes; + LPWSTR lpName, lpStr; - if(hInst == NULL) - { - return -1; - } + if (hInst == NULL) + { + return -1; + } - /* There are always blocks of 16 strings */ - lpName = (LPWSTR)MAKEINTRESOURCE((uID >> 4) + 1); + /* There are always blocks of 16 strings */ + lpName = (LPWSTR)MAKEINTRESOURCE((uID >> 4) + 1); - /* Find the string table block */ - if((hrSrc = FindResourceW(hInst, lpName, (LPWSTR)RT_STRING)) && - (hRes = LoadResource(hInst, hrSrc)) && - (lpStr = LockResource(hRes))) - { - UINT x; + /* Find the string table block */ + if ((hrSrc = FindResourceW(hInst, lpName, (LPWSTR)RT_STRING)) && + (hRes = LoadResource(hInst, hrSrc)) && + (lpStr = LockResource(hRes))) + { + UINT x; - /* Find the string we're looking for */ - uID &= 0xF; /* position in the block, same as % 16 */ - for(x = 0; x < uID; x++) - { - lpStr += (*lpStr) + 1; + /* Find the string we're looking for */ + uID &= 0xF; /* position in the block, same as % 16 */ + for (x = 0; x < uID; x++) + { + lpStr += (*lpStr) + 1; + } + + /* Found the string */ + return (int)(*lpStr); } - - /* Found the string */ - return (int)(*lpStr); - } - return -1; + return -1; } static INT @@ -78,25 +78,25 @@ IN HINSTANCE hInst, IN UINT uID) { - INT ln; + INT ln; - ln = LengthOfStrResource(hInst, - uID); - if(ln++ > 0) - { - (*lpTarget) = (LPWSTR)LocalAlloc(LMEM_FIXED, - ln * sizeof(WCHAR)); - if((*lpTarget) != NULL) + ln = LengthOfStrResource(hInst, + uID); + if (ln++ > 0) { - INT Ret; - if(!(Ret = LoadStringW(hInst, uID, *lpTarget, ln))) - { - LocalFree((HLOCAL)(*lpTarget)); - } - return Ret; + (*lpTarget) = (LPWSTR)LocalAlloc(LMEM_FIXED, + ln * sizeof(WCHAR)); + if ((*lpTarget) != NULL) + { + INT Ret; + if (!(Ret = LoadStringW(hInst, uID, *lpTarget, ln))) + { + LocalFree((HLOCAL)(*lpTarget)); + } + return Ret; + } } - } - return 0; + return 0; } DWORD @@ -105,30 +105,30 @@ OUT LPWSTR *lpTarget, ...) { - DWORD Ret = 0; - LPWSTR lpFormat; - va_list lArgs; + DWORD Ret = 0; + LPWSTR lpFormat; + va_list lArgs; - if(AllocAndLoadString(&lpFormat, - hInstance, - uID) > 0) - { - va_start(lArgs, lpTarget); - /* let's use FormatMessage to format it because it has the ability to allocate - memory automatically */ - Ret = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, - lpFormat, - 0, - 0, - (LPWSTR)lpTarget, - 0, - &lArgs); - va_end(lArgs); + if (AllocAndLoadString(&lpFormat, + hInstance, + uID) > 0) + { + va_start(lArgs, lpTarget); + /* let's use FormatMessage to format it because it has the ability to allocate + memory automatically */ + Ret = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, + lpFormat, + 0, + 0, + (LPWSTR)lpTarget, + 0, + &lArgs); + va_end(lArgs); - LocalFree((HLOCAL)lpFormat); - } + LocalFree((HLOCAL)lpFormat); + } - return Ret; + return Ret; } BOOL
[View Less]
19 years, 8 months
1
0
0
0
[weiden] 18126: add hid.dll to the build system
by weiden@svn.reactos.com
add hid.dll to the build system Modified: trunk/reactos/bootdata/packages/reactos.dff Modified: trunk/reactos/lib/directory.xml Modified: trunk/reactos/lib/hid/hid.c Added: trunk/reactos/lib/hid/hid.xml Deleted: trunk/reactos/lib/hid/internal.h Added: trunk/reactos/lib/hid/precomp.h Modified: trunk/reactos/lib/hid/stubs.c _____ Modified: trunk/reactos/bootdata/packages/reactos.dff --- trunk/reactos/bootdata/packages/reactos.dff 2005-09-27 14:27:14 UTC (rev 18125) +++ trunk/reactos/bootdata/
…
[View More]
packages/reactos.dff 2005-09-27 15:50:49 UTC (rev 18126) @@ -88,6 +88,7 @@ lib\gdi32\gdi32.dll 1 lib\gdiplus\gdiplus.dll 1 lib\glu32\glu32.dll 1 +lib\hid\hid.dll 1 lib\imagehlp\imagehlp.dll 1 lib\imm32\imm32.dll 1 lib\iphlpapi\iphlpapi.dll 1 _____ Modified: trunk/reactos/lib/directory.xml --- trunk/reactos/lib/directory.xml 2005-09-27 14:27:14 UTC (rev 18125) +++ trunk/reactos/lib/directory.xml 2005-09-27 15:50:49 UTC (rev 18126) @@ -92,6 +92,9 @@ <directory name="glu32"> <xi:include href="glu32/glu32.xml" /> </directory> +<directory name="hid"> + <xi:include href="hid/hid.xml" /> +</directory> <directory name="imagehlp"> <xi:include href="imagehlp/imagehlp.xml" /> </directory> Property changes on: trunk/reactos/lib/hid ___________________________________________________________________ Name: svn:ignore - *.coff *.dll *.d *.a *.o *.sym *.map *.tmp + *.coff *.dll *.d *.a *.o *.sym *.map *.tmp GNUmakefile _____ Modified: trunk/reactos/lib/hid/hid.c --- trunk/reactos/lib/hid/hid.c 2005-09-27 14:27:14 UTC (rev 18125) +++ trunk/reactos/lib/hid/hid.c 2005-09-27 15:50:49 UTC (rev 18126) @@ -1,6 +1,6 @@ /* * ReactOS Hid User Library - * Copyright (C) 2004 ReactOS Team + * Copyright (C) 2004-2005 ReactOS Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -21,15 +21,12 @@ * PROJECT: ReactOS Hid User Library * FILE: lib/hid/hid.c * PURPOSE: ReactOS Hid User Library + * PROGRAMMER: Thomas Weidenmueller <w3seek(a)reactos.com> * * UPDATE HISTORY: * 07/12/2004 Created */ -#include <windows.h> -#include <ddk/hidusage.h> -#include <ddk/hidclass.h> -#include <ddk/hidpi.h> -#include "internal.h" +#include <precomp.h> HINSTANCE hDllInstance; _____ Added: trunk/reactos/lib/hid/hid.xml --- trunk/reactos/lib/hid/hid.xml 2005-09-27 14:27:14 UTC (rev 18125) +++ trunk/reactos/lib/hid/hid.xml 2005-09-27 15:50:49 UTC (rev 18126) @@ -0,0 +1,16 @@ +<module name="hid" type="win32dll" baseaddress="${BASEADDRESS_HID}" installbase="system32" installname="hid.dll"> + <importlibrary definition="hid.def" /> + <include base="hid">.</include> + <define name="UNICODE" /> + <define name="_UNICODE" /> + <define name="__USE_W32API" /> + <define name="_WIN32_IE">0x0500</define> + <define name="_WIN32_WINNT">0x0600</define> + <define name="WINVER">0x0600</define> + <library>ntdll</library> + <library>kernel32</library> + <file>hid.c</file> + <file>stubs.c</file> + <file>hid.rc</file> + <pch>precomp.h</pch> +</module> Property changes on: trunk/reactos/lib/hid/hid.xml ___________________________________________________________________ Name: svn:eol-style + native _____ Deleted: trunk/reactos/lib/hid/internal.h --- trunk/reactos/lib/hid/internal.h 2005-09-27 14:27:14 UTC (rev 18125) +++ trunk/reactos/lib/hid/internal.h 2005-09-27 15:50:49 UTC (rev 18126) @@ -1,9 +0,0 @@ -#ifndef __HIDINTERNAL_H -#define __HIDINTERNAL_H - -extern HINSTANCE hDllInstance; -extern const GUID HidClassGuid; - -#endif /* __HIDINTERNAL_H */ - -/* EOF */ _____ Copied: trunk/reactos/lib/hid/precomp.h (from rev 18125, trunk/reactos/lib/hid/internal.h) --- trunk/reactos/lib/hid/internal.h 2005-09-27 14:27:14 UTC (rev 18125) +++ trunk/reactos/lib/hid/precomp.h 2005-09-27 15:50:49 UTC (rev 18126) @@ -0,0 +1,18 @@ +#include <ddk/ntddk.h> +#include <windows.h> + +#define _HIDPI_ +#define _HIDPI_NO_FUNCTION_MACROS_ +#include <ddk/hidusage.h> +#include <ddk/hidclass.h> +#include <ddk/hidpi.h> + +extern HINSTANCE hDllInstance; +extern const GUID HidClassGuid; + +#ifndef UNIMPLEMENTED +#define UNIMPLEMENTED \ + DbgPrint("HID: %s at %s:%d is UNIMPLEMENTED!\n",__FUNCTION__,__FILE__,__LINE__) +#endif + +/* EOF */ _____ Modified: trunk/reactos/lib/hid/stubs.c --- trunk/reactos/lib/hid/stubs.c 2005-09-27 14:27:14 UTC (rev 18125) +++ trunk/reactos/lib/hid/stubs.c 2005-09-27 15:50:49 UTC (rev 18126) @@ -9,14 +9,8 @@ * UPDATE HISTORY: * 07/12/2004 Created */ -#include <windows.h> -#include <ddk/hidpi.h> -#include "internal.h" +#include <precomp.h> -#define UNIMPLEMENTED \ - DbgPrint("HID: %s at %s:%d is UNIMPLEMENTED!\n",__FUNCTION__,__FILE__,__LINE__) - - /* * @unimplemented */
[View Less]
19 years, 8 months
1
0
0
0
[hpoussin] 18125: During 2nd stage setup, define also DNS hostname of the computer if possible
by hpoussin@svn.reactos.com
During 2nd stage setup, define also DNS hostname of the computer if possible Modified: trunk/reactos/lib/syssetup/wizard.c _____ Modified: trunk/reactos/lib/syssetup/wizard.c --- trunk/reactos/lib/syssetup/wizard.c 2005-09-27 13:47:46 UTC (rev 18124) +++ trunk/reactos/lib/syssetup/wizard.c 2005-09-27 14:27:14 UTC (rev 18125) @@ -480,6 +480,8 @@ SetWindowLong(hwndDlg, DWL_MSGRESULT, -1); return TRUE; } + /* Try to also
…
[View More]
set DNS hostname */ + SetComputerNameEx(ComputerNamePhysicalDnsHostname, ComputerName); /* Check admin passwords */ GetDlgItemText(hwndDlg, IDC_ADMINPASSWORD1, Password1, 15);
[View Less]
19 years, 8 months
1
0
0
0
[npwoods] 18124: Regedit: Optimizations to refreshing; refreshing is still slightly slower than Windows regedit
by npwoods@svn.reactos.com
Regedit: Optimizations to refreshing; refreshing is still slightly slower than Windows regedit Modified: trunk/reactos/subsys/system/regedit/treeview.c _____ Modified: trunk/reactos/subsys/system/regedit/treeview.c --- trunk/reactos/subsys/system/regedit/treeview.c 2005-09-27 13:42:20 UTC (rev 18123) +++ trunk/reactos/subsys/system/regedit/treeview.c 2005-09-27 13:47:46 UTC (rev 18124) @@ -134,21 +134,24 @@ HTREEITEM childItem; LPCTSTR KeyPath; DWORD dwCount, dwIndex,
…
[View More]
dwMaxSubKeyLen; - LPSTR Name; + LPSTR Name = NULL; TVITEM tvItem; - + LPTSTR pszNodes = NULL; + BOOL bSuccess = FALSE; + LPTSTR s; + KeyPath = GetItemPath(hwndTV, hItem, &hRoot); if (*KeyPath) { if (RegOpenKeyEx(hRoot, KeyPath, 0, KEY_READ, &hKey) != ERROR_SUCCESS) { - return FALSE; + goto done; } } else { hKey = hRoot; } if (RegQueryInfoKey(hKey, 0, 0, 0, &dwCount, &dwMaxSubKeyLen, 0, 0, 0, 0, 0, 0) != ERROR_SUCCESS) { - return FALSE; + goto done; } /* Set the number of children again */ @@ -156,24 +159,65 @@ tvItem.hItem = hItem; tvItem.cChildren = dwCount; if (!TreeView_SetItem(hwndTV, &tvItem)) { - return FALSE; + goto done; } /* We don't have to bother with the rest if it's not expanded. */ if (TreeView_GetItemState(hwndTV, hItem, TVIS_EXPANDED) == 0) { RegCloseKey(hKey); - return TRUE; + bSuccess = TRUE; + goto done; } dwMaxSubKeyLen++; /* account for the \0 terminator */ if (!(Name = HeapAlloc(GetProcessHeap(), 0, dwMaxSubKeyLen * sizeof(TCHAR)))) { - return FALSE; + goto done; } tvItem.cchTextMax = dwMaxSubKeyLen; if (!(tvItem.pszText = HeapAlloc(GetProcessHeap(), 0, dwMaxSubKeyLen * sizeof(TCHAR)))) { - return FALSE; + goto done; } + /* Get all of the tree node siblings in one contiguous block of memory */ + { + DWORD dwPhysicalSize = 0; + DWORD dwActualSize = 0; + DWORD dwNewPhysicalSize; + LPTSTR pszNewNodes; + DWORD dwStep = 10000; + + for (childItem = TreeView_GetChild(hwndTV, hItem); childItem; + childItem = TreeView_GetNextSibling(hwndTV, childItem)) { + + if (dwActualSize + dwMaxSubKeyLen + 1 > dwPhysicalSize) + { + dwNewPhysicalSize = dwActualSize + dwMaxSubKeyLen + 1 + dwStep; + + if (pszNodes) + pszNewNodes = (LPTSTR) HeapReAlloc(GetProcessHeap(), 0, pszNodes, dwNewPhysicalSize * sizeof(TCHAR)); + else + pszNewNodes = (LPTSTR) HeapAlloc(GetProcessHeap(), 0, dwNewPhysicalSize * sizeof(TCHAR)); + if (!pszNewNodes) + goto done; + + dwPhysicalSize = dwNewPhysicalSize; + pszNodes = pszNewNodes; + } + + tvItem.mask = TVIF_TEXT; + tvItem.hItem = childItem; + tvItem.pszText = &pszNodes[dwActualSize]; + tvItem.cchTextMax = dwPhysicalSize - dwActualSize; + if (!TreeView_GetItem(hwndTV, &tvItem)) + goto done; + + dwActualSize += _tcslen(&pszNodes[dwActualSize]) + 1; + } + + if (pszNodes) + pszNodes[dwActualSize] = '\0'; + } + /* Now go through all the children in the registry, and check if any have to be added. */ for (dwIndex = 0; dwIndex < dwCount; dwIndex++) { DWORD cName = dwMaxSubKeyLen, dwSubCount; @@ -184,36 +228,29 @@ continue; } - /* Find the number of children of the node. */ - dwSubCount = 0; - if (RegOpenKeyEx(hKey, Name, 0, KEY_QUERY_VALUE, &hSubKey) == ERROR_SUCCESS) { - if (RegQueryInfoKey(hSubKey, 0, 0, 0, &dwSubCount, 0, 0, 0, 0, 0, 0, 0) != ERROR_SUCCESS) { - dwSubCount = 0; + /* Check if the node is already in there. */ + if (pszNodes) { + for (s = pszNodes; *s; s += _tcslen(s) + 1) { + if (!strcmp(s, Name)) { + found = TRUE; + break; + } } - RegCloseKey(hSubKey); } - /* Check if the node is already in there. */ - for (childItem = TreeView_GetChild(hwndTV, hItem); childItem; - childItem = TreeView_GetNextSibling(hwndTV, childItem)) { - tvItem.mask = TVIF_TEXT; - tvItem.hItem = childItem; - if (!TreeView_GetItem(hwndTV, &tvItem)) { - return FALSE; + if (found == FALSE) { + /* Find the number of children of the node. */ + dwSubCount = 0; + if (RegOpenKeyEx(hKey, Name, 0, KEY_QUERY_VALUE, &hSubKey) == ERROR_SUCCESS) { + if (RegQueryInfoKey(hSubKey, 0, 0, 0, &dwSubCount, 0, 0, 0, 0, 0, 0, 0) != ERROR_SUCCESS) { + dwSubCount = 0; + } + RegCloseKey(hSubKey); } - if (!strcmp(tvItem.pszText, Name)) { - found = TRUE; - break; - } - } - - if (found == FALSE) { AddEntryToTree(hwndTV, hItem, Name, NULL, dwSubCount); } } - HeapFree(GetProcessHeap(), 0, Name); - HeapFree(GetProcessHeap(), 0, tvItem.pszText); RegCloseKey(hKey); /* Now go through all the children in the tree, and check if any have to be removed. */ @@ -225,8 +262,14 @@ } childItem = nextItem; } + bSuccess = TRUE; - return TRUE; +done: + if (pszNodes) + HeapFree(GetProcessHeap(), 0, pszNodes); + if (Name) + HeapFree(GetProcessHeap(), 0, Name); + return bSuccess; } BOOL RefreshTreeView(HWND hwndTV)
[View Less]
19 years, 8 months
1
0
0
0
[weiden] 18123: load some settings from the registry
by weiden@svn.reactos.com
load some settings from the registry Modified: trunk/reactos/subsys/system/sndvol32/misc.c Modified: trunk/reactos/subsys/system/sndvol32/mixer.c Modified: trunk/reactos/subsys/system/sndvol32/sndvol32.c Modified: trunk/reactos/subsys/system/sndvol32/sndvol32.h _____ Modified: trunk/reactos/subsys/system/sndvol32/misc.c --- trunk/reactos/subsys/system/sndvol32/misc.c 2005-09-27 12:43:36 UTC (rev 18122) +++ trunk/reactos/subsys/system/sndvol32/misc.c 2005-09-27 13:42:20 UTC (rev 18123) @@ -
…
[View More]
127,3 +127,121 @@ return Ret; } +/* NOTE: do NOT modify SNDVOL_REG_LINESTATE for binary compatibility with XP! */ +typedef struct _SNDVOL_REG_LINESTATE +{ + DWORD Flags; + WCHAR LineName[MIXER_LONG_NAME_CHARS]; +} SNDVOL_REG_LINESTATE, *PSNDVOL_REG_LINESTATE; + +static const TCHAR AppRegSettings[] = TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Applets\\Volume Control"); +static const TCHAR AppOptionsKey[] = TEXT("Options"); +static const TCHAR LineStatesValue[] = TEXT("LineStates"); +static const TCHAR StyleValue[] = TEXT("Style"); + +HKEY hAppSettingsKey = NULL; + +BOOL +InitAppConfig(VOID) +{ + return RegCreateKeyEx(HKEY_CURRENT_USER, + AppRegSettings, + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_READ | KEY_WRITE, + NULL, + &hAppSettingsKey, + NULL) == ERROR_SUCCESS; +} + +VOID +CloseAppConfig(VOID) +{ + if (hAppSettingsKey != NULL) + { + RegCloseKey(hAppSettingsKey); + hAppSettingsKey = NULL; + } +} + +BOOL +ReadLineConfig(IN LPTSTR szDeviceName, + IN LPTSTR szLineName, + IN LPTSTR szControlName, + OUT DWORD *Flags) +{ + HKEY hLineKey; + DWORD Type; + DWORD i, Size = 0; + PSNDVOL_REG_LINESTATE LineStates = NULL; + TCHAR szDevRegKey[MAX_PATH]; + BOOL Ret = FALSE; + + _stprintf(szDevRegKey, + TEXT("%s\\%s"), + szDeviceName, + szLineName); + + if (RegCreateKeyEx(hAppSettingsKey, + szDevRegKey, + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_READ | KEY_WRITE, + NULL, + &hLineKey, + NULL) == ERROR_SUCCESS) + { + if (RegQueryValueEx(hLineKey, + LineStatesValue, + NULL, + &Type, + NULL, + &Size) != ERROR_SUCCESS || + Type != REG_BINARY || + Size == 0 || (Size % sizeof(SNDVOL_REG_LINESTATE) != 0)) + { + goto ExitClose; + } + + LineStates = HeapAlloc(GetProcessHeap(), + 0, + Size); + + if (LineStates != NULL) + { + if (RegQueryValueEx(hLineKey, + LineStatesValue, + NULL, + &Type, + (LPBYTE)LineStates, + &Size) != ERROR_SUCCESS || + Type != REG_BINARY || + Size == 0 || (Size % sizeof(SNDVOL_REG_LINESTATE) != 0)) + { + goto ExitClose; + } + + /* try to find the control */ + for (i = 0; i < Size / sizeof(SNDVOL_REG_LINESTATE); i++) + { + if (!_tcscmp(szControlName, + LineStates[i].LineName)) + { + *Flags = LineStates[i].Flags; + Ret = TRUE; + break; + } + } + } + +ExitClose: + HeapFree(GetProcessHeap(), + 0, + LineStates); + RegCloseKey(hLineKey); + } + + return Ret; +} _____ Modified: trunk/reactos/subsys/system/sndvol32/mixer.c --- trunk/reactos/subsys/system/sndvol32/mixer.c 2005-09-27 12:43:36 UTC (rev 18122) +++ trunk/reactos/subsys/system/sndvol32/mixer.c 2005-09-27 13:42:20 UTC (rev 18123) @@ -111,6 +111,7 @@ static BOOL SndMixerQueryControls(PSND_MIXER Mixer, + PUINT DisplayControls, LPMIXERLINE LineInfo, LPMIXERCONTROL *Controls) { @@ -138,7 +139,13 @@ { for (j = 0; j < LineControls.cControls; j++) { - DPRINT("Line control: %ws\n", (*Controls)[j].szName); + if (SndMixerIsDisplayControl(Mixer, + &(*Controls)[j])) + { + (*DisplayControls)++; + } + + DPRINT("Line control: %ws (0x%x, 0x%x)\n", (*Controls)[j].szName, (*Controls)[j].fdwControl, (*Controls)[j].dwControlType); } return TRUE; @@ -169,7 +176,7 @@ SndMixerQueryConnections(PSND_MIXER Mixer, PSND_MIXER_DESTINATION Line) { - UINT i; + UINT i, DispControls; MIXERLINE LineInfo; MMRESULT Result; BOOL Ret = TRUE; @@ -188,8 +195,11 @@ PSND_MIXER_CONNECTION Con; DPRINT("++ Source: %ws\n", LineInfo.szName); + + DispControls = 0; if (!SndMixerQueryControls(Mixer, + &DispControls, &LineInfo, &Controls)) { @@ -205,6 +215,7 @@ { Con->Info = LineInfo; Con->Controls = Controls; + Con->DisplayControls = DispControls; Con->Next = Line->Connections; Line->Connections = Con; } @@ -247,15 +258,10 @@ &Line->Info, MIXER_GETLINEINFOF_DESTINATION) == MMSYSERR_NOERROR) { - DPRINT("+ Destination: %ws (%d)\n", Line->Info.szName, Line->Info.dwComponentType); - - if (!SndMixerQueryConnections(Mixer, Line)) - { - DPRINT("Failed to query mixer connections!\n"); - Ret = FALSE; - break; - } + DPRINT("+ Destination: %ws (0x%x, %d)\n", Line->Info.szName, Line->Info.dwLineID, Line->Info.dwComponentType); + if (!SndMixerQueryControls(Mixer, + &Line->DisplayControls, &Line->Info, &Line->Controls)) { @@ -264,6 +270,13 @@ break; } + if (!SndMixerQueryConnections(Mixer, Line)) + { + DPRINT("Failed to query mixer connections!\n"); + Ret = FALSE; + break; + } + Line->Next = Mixer->Lines; Mixer->Lines = Line; } @@ -374,6 +387,47 @@ return -1; } +INT +SndMixerGetLineName(PSND_MIXER Mixer, + DWORD LineID, + LPTSTR lpBuffer, + UINT uSize, + BOOL LongName) +{ + if (Mixer->hmx) + { + int lnsz; + PSND_MIXER_DESTINATION Line; + LPMIXERLINE lpl = NULL; + + for (Line = Mixer->Lines; Line != NULL; Line = Line->Next) + { + if (Line->Info.dwLineID == LineID) + { + lpl = &Line->Info; + break; + } + } + + if (lpl != NULL) + { + lnsz = lstrlen(LongName ? lpl->szName : lpl->szShortName); + if(lnsz + 1 > uSize) + { + return lnsz + 1; + } + else + { + memcpy(lpBuffer, LongName ? lpl->szName : lpl->szShortName, lnsz * sizeof(TCHAR)); + lpBuffer[lnsz] = _T('\0'); + return lnsz; + } + } + } + + return -1; +} + BOOL SndMixerEnumProducts(PSND_MIXER Mixer, PFNSNDMIXENUMPRODUCTS EnumProc, @@ -436,6 +490,7 @@ { if (!EnumProc(Mixer, &Line->Info, + Line->DisplayControls, Context)) { return FALSE; @@ -463,6 +518,17 @@ if (Line->Info.dwLineID == LineID) { PSND_MIXER_CONNECTION Connection; + + if (Line->DisplayControls != 0) + { + if (!EnumProc(Mixer, + LineID, + &Line->Info, + Context)) + { + return FALSE; + } + } for (Connection = Line->Connections; Connection != NULL; Connection = Connection->Next) { @@ -483,3 +549,20 @@ return FALSE; } +BOOL +SndMixerIsDisplayControl(PSND_MIXER Mixer, + LPMIXERCONTROL Control) +{ + if (Mixer->hmx && !(Control->fdwControl & MIXERCONTROL_CONTROLF_DISABLED)) + { + switch (Control->dwControlType & MIXERCONTROL_CT_CLASS_MASK) + { + case MIXERCONTROL_CT_CLASS_FADER: + case MIXERCONTROL_CT_CLASS_SWITCH: + return TRUE; + } + } + + return FALSE; +} + _____ Modified: trunk/reactos/subsys/system/sndvol32/sndvol32.c --- trunk/reactos/subsys/system/sndvol32/sndvol32.c 2005-09-27 12:43:36 UTC (rev 18122) +++ trunk/reactos/subsys/system/sndvol32/sndvol32.c 2005-09-27 13:42:20 UTC (rev 18123) @@ -51,6 +51,7 @@ DWORD PlaybackID; DWORD RecordingID; UINT OtherLines; + TCHAR DeviceName[128]; DWORD tmp; } PREFERENCES_CONTEXT, *PPREFERENCES_CONTEXT; @@ -98,6 +99,7 @@ static BOOL CALLBACK PrefDlgAddLine(PSND_MIXER Mixer, LPMIXERLINE Line, + UINT DisplayControls, PVOID Context) { PPREFERENCES_CONTEXT PrefContext = (PPREFERENCES_CONTEXT)Context; @@ -113,6 +115,8 @@ { PrefContext->SelectedLine = Line->dwLineID; } + + DPRINT("!%ws cControls: %d\n", Line->szName, Line->cControls); } else goto AddToOthersLines; @@ -128,6 +132,7 @@ { PrefContext->SelectedLine = Line->dwLineID; } + DPRINT("!%ws cControls: %d\n", Line->szName, Line->cControls); } else goto AddToOthersLines; @@ -196,10 +201,33 @@ (LPARAM)&lvi); if (i != (UINT)-1) { - /* FIXME - read config from registry */ + TCHAR LineName[MIXER_LONG_NAME_CHARS]; + DWORD Flags; + BOOL SelLine = FALSE; + + if (SndMixerGetLineName(PrefContext->Mixer, + PrefContext->SelectedLine, + LineName, + MIXER_LONG_NAME_CHARS, + FALSE) == -1) + { + LineName[0] = TEXT('\0'); + } + + if (ReadLineConfig(PrefContext->DeviceName, + LineName, + Line->szName, + &Flags)) + { + if (Flags != 0x4) + { + SelLine = TRUE; + } + } + ListView_SetCheckState(hwndControls, i, - FALSE); + SelLine); } } @@ -214,18 +242,18 @@ INT DeviceCbIndex; /* select the mixer */ - DeviceCbIndex = SendMessage(GetDlgItem(Context->hwndDlg, - IDC_MIXERDEVICE), - CB_GETCURSEL, - 0, - 0); + DeviceCbIndex = SendDlgItemMessage(Context->hwndDlg, + IDC_MIXERDEVICE, + CB_GETCURSEL, + 0, + 0); if (DeviceCbIndex != CB_ERR) { - MixerID = SendMessage(GetDlgItem(Context->hwndDlg, - IDC_MIXERDEVICE), - CB_GETITEMDATA, - DeviceCbIndex, - 0); + MixerID = SendDlgItemMessage(Context->hwndDlg, + IDC_MIXERDEVICE, + CB_GETITEMDATA, + DeviceCbIndex, + 0); if (MixerID == CB_ERR) { MixerID = 0; @@ -244,6 +272,10 @@ Context->RecordingID = (DWORD)-1; Context->OtherLines = 0; Context->SelectedLine = (DWORD)-1; + + SndMixerGetProductName(Context->Mixer, + Context->DeviceName, + sizeof(Context->DeviceName) / sizeof(Context->DeviceName[0])); if (SndMixerEnumLines(Context->Mixer, PrefDlgAddLine, @@ -271,11 +303,11 @@ if (Context->OtherLines != 0) { /* select the first item in the other lines combo box by default */ - SendMessage(GetDlgItem(Context->hwndDlg, - IDC_LINE), - CB_SETCURSEL, - 0, - 0); + SendDlgItemMessage(Context->hwndDlg, + IDC_LINE, + CB_SETCURSEL, + 0, + 0); } EnableWindow(GetDlgItem(Context->hwndDlg, IDC_LINE), @@ -349,18 +381,18 @@ DWORD LineID; DWORD Index; - Index = SendMessage(GetDlgItem(hwndDlg, - IDC_LINE), - CB_GETCURSEL, - 0, - 0); + Index = SendDlgItemMessage(hwndDlg, + IDC_LINE, + CB_GETCURSEL, + 0, + 0); if (Index != CB_ERR) { - LineID = SendMessage(GetDlgItem(hwndDlg, - IDC_LINE), - CB_GETITEMDATA, - Index, - 0); + LineID = SendDlgItemMessage(hwndDlg, + IDC_LINE, + CB_GETITEMDATA, + Index, + 0); if (LineID != CB_ERR) { UpdatePrefDlgControls(Context, @@ -769,6 +801,12 @@ hAppInstance = hInstance; hAppHeap = GetProcessHeap(); + if (!InitAppConfig()) + { + DPRINT("Unable to open the Volume Control registry key!\n"); + return 1; + } + /* load the application title */ if (AllocAndLoadString(&lpAppTitle, hAppInstance, @@ -809,6 +847,8 @@ { LocalFree(lpAppTitle); } + + CloseAppConfig(); return 0; } _____ Modified: trunk/reactos/subsys/system/sndvol32/sndvol32.h --- trunk/reactos/subsys/system/sndvol32/sndvol32.h 2005-09-27 12:43:36 UTC (rev 18122) +++ trunk/reactos/subsys/system/sndvol32/sndvol32.h 2005-09-27 13:42:20 UTC (rev 18123) @@ -42,6 +42,7 @@ struct _SND_MIXER_CONNECTION *Next; MIXERLINE Info; LPMIXERCONTROL Controls; + UINT DisplayControls; } SND_MIXER_CONNECTION, *PSND_MIXER_CONNECTION; @@ -50,6 +51,7 @@ struct _SND_MIXER_DESTINATION *Next; MIXERLINE Info; LPMIXERCONTROL Controls; + UINT DisplayControls; PSND_MIXER_CONNECTION Connections; } SND_MIXER_DESTINATION, *PSND_MIXER_DESTINATION; @@ -63,7 +65,7 @@ PSND_MIXER_DESTINATION Lines; } SND_MIXER, *PSND_MIXER; -typedef BOOL (CALLBACK *PFNSNDMIXENUMLINES)(PSND_MIXER Mixer, LPMIXERLINE Line, PVOID Context); +typedef BOOL (CALLBACK *PFNSNDMIXENUMLINES)(PSND_MIXER Mixer, LPMIXERLINE Line, UINT DisplayControls, PVOID Context); typedef BOOL (CALLBACK *PFNSNDMIXENUMCONNECTIONS)(PSND_MIXER Mixer, DWORD LineID, LPMIXERLINE Line, PVOID Context); typedef BOOL (CALLBACK *PFNSNDMIXENUMPRODUCTS)(PSND_MIXER Mixer, UINT Id, LPCTSTR ProductName, PVOID Context); @@ -73,14 +75,25 @@ BOOL SndMixerSelect(PSND_MIXER Mixer, UINT MixerId); UINT SndMixerGetSelection(PSND_MIXER Mixer); INT SndMixerGetProductName(PSND_MIXER Mixer, LPTSTR lpBuffer, UINT uSize); +INT SndMixerGetLineName(PSND_MIXER Mixer, DWORD LineID, LPTSTR lpBuffer, UINT uSize, BOOL LongName); BOOL SndMixerEnumProducts(PSND_MIXER Mixer, PFNSNDMIXENUMPRODUCTS EnumProc, PVOID Context); INT SndMixerGetDestinationCount(PSND_MIXER Mixer); BOOL SndMixerEnumLines(PSND_MIXER Mixer, PFNSNDMIXENUMLINES EnumProc, PVOID Context); BOOL SndMixerEnumConnections(PSND_MIXER Mixer, DWORD LineID, PFNSNDMIXENUMCONNECTIONS EnumProc, PVOID Context); +BOOL SndMixerIsDisplayControl(PSND_MIXER Mixer, LPMIXERCONTROL Control); /* * MISC */ + +extern HKEY hAppSettingsKey; + +BOOL +InitAppConfig(VOID); + +VOID +CloseAppConfig(VOID); + INT AllocAndLoadString(OUT LPWSTR *lpTarget, IN HINSTANCE hInst, @@ -92,4 +105,10 @@ OUT LPWSTR *lpTarget, ...); +BOOL +ReadLineConfig(IN LPTSTR szDeviceName, + IN LPTSTR szLineName, + IN LPTSTR szControlName, + OUT DWORD *Flags); + #endif /* __SNDVOL32_H */
[View Less]
19 years, 8 months
1
0
0
0
[hpoussin] 18122: KEBUGCHECK(0) -> KEBUGCHECK(INACCESSIBLE_BOOT_DEVICE)
by hpoussin@svn.reactos.com
KEBUGCHECK(0) -> KEBUGCHECK(INACCESSIBLE_BOOT_DEVICE) Modified: trunk/reactos/ntoskrnl/io/driver.c _____ Modified: trunk/reactos/ntoskrnl/io/driver.c --- trunk/reactos/ntoskrnl/io/driver.c 2005-09-27 12:40:20 UTC (rev 18121) +++ trunk/reactos/ntoskrnl/io/driver.c 2005-09-27 12:43:36 UTC (rev 18122) @@ -1,5 +1,4 @@ -/* $Id$ - * +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * FILE: ntoskrnl/io/driver.c @@ -1352,7 +1351,7 @
…
[View More]
@ if (BootDriverCount == 0) { DbgPrint("No boot drivers available.\n"); - KEBUGCHECK(0); + KEBUGCHECK(INACCESSIBLE_BOOT_DEVICE); } }
[View Less]
19 years, 8 months
1
0
0
0
← Newer
1
2
3
4
5
6
7
8
9
...
59
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
Results per page:
10
25
50
100
200