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
October 2005
----- 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
26 participants
737 discussions
Start a n
N
ew thread
[cwittich] 18819: fixed 4 memory leaks
by cwittich@svn.reactos.com
fixed 4 memory leaks Modified: trunk/reactos/subsys/system/regedit/childwnd.c Modified: trunk/reactos/subsys/system/regedit/listview.c Modified: trunk/reactos/subsys/system/regedit/main.c Modified: trunk/reactos/subsys/system/regedit/main.h Modified: trunk/reactos/subsys/system/regedit/treeview.c _____ Modified: trunk/reactos/subsys/system/regedit/childwnd.c --- trunk/reactos/subsys/system/regedit/childwnd.c 2005-10-28 00:03:01 UTC (rev 18818) +++ trunk/reactos/subsys/system/regedit/childwnd.c 2005-10-28 00:14:27 UTC (rev 18819) @@ -310,6 +310,9 @@ } goto def; case WM_DESTROY: + DestroyTreeView(); + DestroyListView(pChildWnd->hListWnd); + DestroyMainMenu(); HeapFree(GetProcessHeap(), 0, pChildWnd); pChildWnd = NULL; PostQuitMessage(0); _____ Modified: trunk/reactos/subsys/system/regedit/listview.c --- trunk/reactos/subsys/system/regedit/listview.c 2005-10-28 00:03:01 UTC (rev 18818) +++ trunk/reactos/subsys/system/regedit/listview.c 2005-10-28 00:14:27 UTC (rev 18819) @@ -494,6 +494,24 @@ return NULL; } +void DestroyListView(HWND hwndLV) { + INT count, i; + LVITEM item; + + if (g_valueName) + HeapFree(GetProcessHeap(), 0, g_valueName); + + count = ListView_GetItemCount(hwndLV); + for (i = 0; i < count; i++) { + item.mask = LVIF_PARAM; + item.iItem = i; + ListView_GetItem(hwndLV, &item); + free(((LINE_INFO*)item.lParam)->name); + HeapFree(GetProcessHeap(), 0, (void*)item.lParam); + } + +} + BOOL RefreshListView(HWND hwndLV, HKEY hKey, LPCTSTR keyPath) { DWORD max_sub_key_len; _____ Modified: trunk/reactos/subsys/system/regedit/main.c --- trunk/reactos/subsys/system/regedit/main.c 2005-10-28 00:03:01 UTC (rev 18818) +++ trunk/reactos/subsys/system/regedit/main.c 2005-10-28 00:14:27 UTC (rev 18819) @@ -181,10 +181,19 @@ /*********************************************************************** *******/ +/* we need to destroy the main menu before destroying the main window + to avoid a memory leak */ + +void DestroyMainMenu() { + DestroyMenu(hMenuFrame); +} + +/********************************************************************** ********/ + void ExitInstance(HINSTANCE hInstance) { UnregisterHexEditorClass(hInstance); - DestroyMenu(hMenuFrame); + DestroyMenu(hPopupMenus); UnloadAclUiDll(); } _____ Modified: trunk/reactos/subsys/system/regedit/main.h --- trunk/reactos/subsys/system/regedit/main.h 2005-10-28 00:03:01 UTC (rev 18818) +++ trunk/reactos/subsys/system/regedit/main.h 2005-10-28 00:14:27 UTC (rev 18819) @@ -107,6 +107,9 @@ extern HWND StartKeyRename(HWND hwndTV); extern BOOL CreateNewKey(HWND hwndTV, HTREEITEM hItem); extern BOOL SelectNode(HWND hwndTV, LPCTSTR keyPath); +extern void DestroyTreeView( void ); +extern void DestroyListView( HWND hwndLV ); +extern void DestroyMainMenu( void ); /* edit.c */ extern BOOL ModifyValue(HWND hwnd, HKEY hKey, LPCTSTR valueName, BOOL EditBin); _____ Modified: trunk/reactos/subsys/system/regedit/treeview.c --- trunk/reactos/subsys/system/regedit/treeview.c 2005-10-28 00:03:01 UTC (rev 18818) +++ trunk/reactos/subsys/system/regedit/treeview.c 2005-10-28 00:14:27 UTC (rev 18819) @@ -101,7 +101,9 @@ if (maxLen == -1) return NULL; if (!hItem) hItem = TreeView_GetSelection(hwndTV); if (!hItem) return NULL; - if (!get_item_path(hwndTV, hItem, phRootKey, &pathBuffer, &pathLen, &maxLen)) return NULL; + if (!get_item_path(hwndTV, hItem, phRootKey, &pathBuffer, &pathLen, &maxLen)) { + return NULL; + } return pathBuffer; } @@ -561,6 +563,11 @@ return hwndTV; } +void DestroyTreeView() { + if (pathBuffer) + HeapFree(GetProcessHeap(), 0, pathBuffer); +} + BOOL SelectNode(HWND hwndTV, LPCTSTR keyPath) { HTREEITEM hRoot, hItem;
19 years, 1 month
1
0
0
0
[weiden] 18818: simplify returning the previous count in NtReleaseMutant
by weiden@svn.reactos.com
simplify returning the previous count in NtReleaseMutant Modified: trunk/reactos/ntoskrnl/ex/mutant.c _____ Modified: trunk/reactos/ntoskrnl/ex/mutant.c --- trunk/reactos/ntoskrnl/ex/mutant.c 2005-10-27 23:48:22 UTC (rev 18817) +++ trunk/reactos/ntoskrnl/ex/mutant.c 2005-10-28 00:03:01 UTC (rev 18818) @@ -322,14 +322,17 @@ /* Check for Success and release if such */ if(NT_SUCCESS(Status)) { - LONG Prev = 0; - /* release the mutant. doing so might raise an exception which we're required to catch! */ _SEH_TRY { - Prev = KeReleaseMutant(Mutant, MUTANT_INCREMENT, FALSE, FALSE); + LONG Prev = KeReleaseMutant(Mutant, MUTANT_INCREMENT, FALSE, FALSE); + if(PreviousCount) { + + *PreviousCount = Prev; + } + } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { Status = _SEH_GetExceptionCode(); @@ -337,23 +340,6 @@ } _SEH_END; ObDereferenceObject(Mutant); - - if(NT_SUCCESS(Status)) { - - /* Return it */ - if(PreviousCount) { - - _SEH_TRY { - - *PreviousCount = Prev; - - } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { - - Status = _SEH_GetExceptionCode(); - - } _SEH_END; - } - } } /* Return Status */
19 years, 1 month
1
0
0
0
[weiden] 18817: Fixed ProbeForRead* macros: make sure the data always is read while probing it
by weiden@svn.reactos.com
Fixed ProbeForRead* macros: make sure the data always is read while probing it Modified: trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h _____ Modified: trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h --- trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h 2005-10-27 23:31:14 UTC (rev 18816) +++ trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h 2005-10-27 23:48:22 UTC (rev 18817) @@ -134,7 +134,6 @@ else { /* sanitize structure */ - Dest->Length = 0; Dest->MaximumLength = 0; Dest->Buffer = NULL; } @@ -209,7 +208,7 @@ (((ULONG_PTR)(Ptr) + sizeof(Type) - 1 < (ULONG_PTR)(Ptr) || \ (ULONG_PTR)(Ptr) + sizeof(Type) - 1 >= (ULONG_PTR)MmUserProbeAddress) ? \ ExRaiseStatus (STATUS_ACCESS_VIOLATION), Default : \ - *(Type *)(Ptr)) + *(volatile Type *)(Ptr)) #define ProbeForReadBoolean(Ptr) ProbeForReadGenericType(Ptr, BOOLEAN, FALSE) #define ProbeForReadUchar(Ptr) ProbeForReadGenericType(Ptr, UCHAR, 0)
19 years, 1 month
1
0
0
0
[weiden] 18816: crash the system is someone uses RTL functions that normally shouldn't be in ntoskrnl at all
by weiden@svn.reactos.com
crash the system is someone uses RTL functions that normally shouldn't be in ntoskrnl at all Modified: trunk/reactos/ntoskrnl/rtl/libsupp.c _____ Modified: trunk/reactos/ntoskrnl/rtl/libsupp.c --- trunk/reactos/ntoskrnl/rtl/libsupp.c 2005-10-27 23:24:15 UTC (rev 18815) +++ trunk/reactos/ntoskrnl/rtl/libsupp.c 2005-10-27 23:31:14 UTC (rev 18816) @@ -98,6 +98,7 @@ RtlDeleteHeapLock( PRTL_CRITICAL_SECTION CriticalSection) { + KEBUGCHECK(0); return STATUS_SUCCESS; } @@ -106,7 +107,7 @@ RtlEnterHeapLock( PRTL_CRITICAL_SECTION CriticalSection) { - ExAcquireFastMutex((PFAST_MUTEX) CriticalSection); + KEBUGCHECK(0); return STATUS_SUCCESS; } @@ -115,7 +116,7 @@ RtlInitializeHeapLock( PRTL_CRITICAL_SECTION CriticalSection) { - ExInitializeFastMutex((PFAST_MUTEX)CriticalSection ); + KEBUGCHECK(0); return STATUS_SUCCESS; } @@ -124,7 +125,7 @@ RtlLeaveHeapLock( PRTL_CRITICAL_SECTION CriticalSection) { - ExReleaseFastMutex((PFAST_MUTEX) CriticalSection ); + KEBUGCHECK(0); return STATUS_SUCCESS; }
19 years, 1 month
1
0
0
0
[weiden] 18815: fixed ProbeAndCaptureUnicodeString to properly capture unicode strings
by weiden@svn.reactos.com
fixed ProbeAndCaptureUnicodeString to properly capture unicode strings Modified: trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h _____ Modified: trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h --- trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h 2005-10-27 23:13:04 UTC (rev 18814) +++ trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h 2005-10-27 23:24:15 UTC (rev 18815) @@ -90,11 +90,11 @@ NTSTATUS NTAPI ProbeAndCaptureUnicodeString(OUT PUNICODE_STRING Dest, - KPROCESSOR_MODE CurrentMode, + IN KPROCESSOR_MODE CurrentMode, IN PUNICODE_STRING UnsafeSrc) { NTSTATUS Status = STATUS_SUCCESS; - PVOID Buffer; + WCHAR *Buffer; ASSERT(Dest != NULL); /* Probe the structure and buffer*/ @@ -106,41 +106,59 @@ sizeof(UNICODE_STRING), sizeof(ULONG)); *Dest = *UnsafeSrc; - if(Dest->Length > 0) + if(Dest->Buffer != NULL) { - ProbeForRead(Dest->Buffer, - Dest->Length, - sizeof(WCHAR)); + if (Dest->Length != 0) + { + ProbeForRead(Dest->Buffer, + Dest->Length, + sizeof(WCHAR)); + + /* Allocate space for the buffer */ + Buffer = ExAllocatePoolWithTag(PagedPool, + Dest->Length + sizeof(WCHAR), + TAG('U', 'S', 'T', 'R')); + if (Buffer == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + _SEH_LEAVE; + } + + /* Copy it */ + RtlCopyMemory(Buffer, Dest->Buffer, Dest->Length); + Buffer[Dest->Length / sizeof(WCHAR)] = UNICODE_NULL; + + /* Set it as the buffer */ + Dest->Buffer = Buffer; + } + else + { + /* sanitize structure */ + Dest->Length = 0; + Dest->MaximumLength = 0; + Dest->Buffer = NULL; + } } + else + { + /* sanitize structure */ + Dest->Length = 0; + Dest->MaximumLength = 0; + } } _SEH_HANDLE { Status = _SEH_GetExceptionCode(); } _SEH_END; - - if (!NT_SUCCESS(Status)) return Status; } else { - /* Just copy it directly */ + /* Just copy the UNICODE_STRING structure, don't allocate new memory! + We trust the caller to supply valid pointers and data. */ *Dest = *UnsafeSrc; } - /* Allocate space for the buffer */ - Buffer = ExAllocatePool(PagedPool, Dest->MaximumLength); - - if (Buffer != NULL) - { - /* Copy it */ - RtlCopyMemory(Buffer, Dest->Buffer, Dest->MaximumLength); - - /* Set it as the buffer */ - Dest->Buffer = Buffer; - } - else - Status = STATUS_INSUFFICIENT_RESOURCES; - /* Return */ return Status; } @@ -149,9 +167,12 @@ VOID NTAPI ReleaseCapturedUnicodeString(IN PUNICODE_STRING CapturedString, - KPROCESSOR_MODE CurrentMode) + IN KPROCESSOR_MODE CurrentMode) { - if(CurrentMode != KernelMode) ExFreePool(CapturedString->Buffer); + if(CurrentMode != KernelMode && CapturedString->Buffer != NULL) + { + ExFreePool(CapturedString->Buffer); + } } /*
19 years, 1 month
1
0
0
0
[gedmurphy] 18814: - start of a rewrite for ipconfig
by gedmurphy@svn.reactos.com
- start of a rewrite for ipconfig - simulate the MS netstat utilitys output - again, it's incomplete, but commiting for SVN log purposes. Modified: trunk/reactos/apps/utils/net/ipconfig/ipconfig.c Modified: trunk/reactos/apps/utils/net/ipconfig/ipconfig.rc Modified: trunk/reactos/apps/utils/net/ipconfig/ipconfig.xml Deleted: trunk/reactos/apps/utils/net/ipconfig/trace.c Deleted: trunk/reactos/apps/utils/net/ipconfig/trace.h _____ Modified: trunk/reactos/apps/utils/net/ipconfig/ipconfig.c --- trunk/reactos/apps/utils/net/ipconfig/ipconfig.c 2005-10-27 22:33:17 UTC (rev 18813) +++ trunk/reactos/apps/utils/net/ipconfig/ipconfig.c 2005-10-27 23:13:04 UTC (rev 18814) @@ -1,380 +1,396 @@ -/* $Id: ipconfig.c - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS Ipconfig utility - * FILE: apps/utils/net/ipconfig/ipconfig.c - * PURPOSE: Show and set network interface IP parameters - */ /* - * History: + * ReactOS Win32 Applications + * Copyright (C) 2005 ReactOS Team * - * 15/8/2002 (Robert Dickenson <robd(a)reactos.org>) - * Original version (PUBLIC DOMAIN and NO WARRANTY) + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS arp utility + * FILE: apps/utils/net/ipconfig/ipconfig.c + * PURPOSE: + * PROGRAMMERS: Ged Murphy (gedmurphy(a)gmail.com) + * REVISIONS: + * GM 14/09/05 Created * - * 26/6/2005 (Tim Jobling <tjob800(a)yahoo.co.uk>) - * Relicense to GPL. - * Display NodeType with meaningfull Human readable names. - * Exclusively use TCHAR strings. - * Display Physical Address, DHCP enabled state, IP Addresses/Netmasks, - * Default Gateway, DHCP server and DHCP Lease times. - * Parse command line options. - * Default to only showing the IP/SM/DG is no options specified - * Handel option: /All and /? - * Display message about all unimplemented options. - * Changed C++ style commenting to C style - * -*/ - + */ +/* + * TODO: + * display multiple adapters + * fix renew / release + * implement flushdns, registerdns, displaydns, showclassid, setclassid + * allow globbing on adapter names + */ +#define WIN32_LEAN_AND_MEAN +#include <windows.h> #include <stdio.h> -#include <windows.h> +#include <stdlib.h> +#include <time.h> #include <tchar.h> -#include <time.h> - -#include <iptypes.h> -#include <ipexport.h> +#include <string.h> +#include <ctype.h> +#include <winsock2.h> #include <iphlpapi.h> -#ifdef _DEBUG -#include "trace.h" -#endif +#define UNICODE +#define _UNICODE -/* imported from iphlpapi.dll -GetAdapterOrderMap -GetInterfaceInfo -GetIpStatsFromStack -NhGetInterfaceNameFromGuid -NhpAllocateAndGetInterfaceInfoFromStack - - */ - -static TCHAR* GetNodeTypeName(UINT nNodeType) +PTCHAR GetNodeTypeName(UINT NodeType) { - switch (nNodeType) { - case 1: return _T("Broadcast"); - case 2: return _T("Peer To Peer"); - case 4: return _T("Mixed"); - case 8: return _T("Hybrid"); - default: return _T("unknown"); + switch (NodeType) { + case 1: return _T("Broadcast"); + case 2: return _T("Peer To Peer"); + case 4: return _T("Mixed"); + case 8: return _T("Hybrid"); + default : return _T("unknown"); } } -static TCHAR* GetInterfaceTypeName(UINT nInterfaceType) +PTCHAR GetInterfaceTypeName(UINT InterfaceType) { - switch (nInterfaceType) { - case MIB_IF_TYPE_OTHER: return _T("Other"); - case MIB_IF_TYPE_ETHERNET: return _T("Ethernet"); - case MIB_IF_TYPE_TOKENRING: return _T("Token Ring"); - case MIB_IF_TYPE_FDDI: return _T("FDDI"); - case MIB_IF_TYPE_PPP: return _T("PPP"); - case MIB_IF_TYPE_LOOPBACK: return _T("Loopback"); - case MIB_IF_TYPE_SLIP: return _T("SLIP"); - default: return _T("unknown"); + switch (InterfaceType) { + case MIB_IF_TYPE_OTHER: return _T("Other Type Of Adapter"); + case MIB_IF_TYPE_ETHERNET: return _T("Ethernet Adapter"); + case MIB_IF_TYPE_TOKENRING: return _T("Token Ring Adapter"); + case MIB_IF_TYPE_FDDI: return _T("FDDI Adapter"); + case MIB_IF_TYPE_PPP: return _T("PPP Adapter"); + case MIB_IF_TYPE_LOOPBACK: return _T("Loopback Adapter"); + case MIB_IF_TYPE_SLIP: return _T("SLIP Adapter"); + default: return _T("unknown"); } } -static void PrintPhysicalAddr(PBYTE Addr, UINT len) +/* print MAC address */ +PTCHAR PrintMacAddr(PBYTE Mac) { - UINT i=0; - for (i=0; i<len; i++) - { - _tprintf(_T("%02X"), Addr[i]); - if ((i+1)<len) - _tprintf(_T("-")); - } - _tprintf(_T("\n")); + static TCHAR MacAddr[20]; + + _stprintf(MacAddr, _T("%02x-%02x-%02x-%02x-%02x-%02x"), + Mac[0], Mac[1], Mac[2], Mac[3], Mac[4], Mac[5]); + + return MacAddr; } -static void ShowNetworkFixedInfo() +DWORD DoFormatMessage(DWORD ErrorCode) { - FIXED_INFO* pFixedInfo = NULL; - ULONG OutBufLen = 0; - DWORD result; + LPVOID lpMsgBuf; + DWORD RetVal; - result = GetNetworkParams(NULL, &OutBufLen); - if (result == ERROR_BUFFER_OVERFLOW) { - pFixedInfo = (FIXED_INFO*)malloc(OutBufLen); - if (!pFixedInfo) { - _tprintf(_T("ERROR: failed to allocate 0x%08lX bytes of memory\n"), OutBufLen); - return; - } - } else { - _tprintf(_T("ERROR: GetNetworkParams() failed to report required buffer size.\n")); - return; + if ((RetVal = FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + ErrorCode, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */ + (LPTSTR) &lpMsgBuf, + 0, + NULL ))) { + _tprintf(_T("%s"), (LPTSTR)lpMsgBuf); + + LocalFree(lpMsgBuf); + /* return number of TCHAR's stored in output buffer + * excluding '\0' - as FormatMessage does*/ + return RetVal; } + else + return 0; +} - result = GetNetworkParams(pFixedInfo, &OutBufLen); - if (result == ERROR_SUCCESS) { - IP_ADDR_STRING* pIPAddr; +INT ShowInfo(BOOL bAll) +{ + PIP_ADAPTER_INFO pAdapterInfo; + PIP_ADAPTER_INFO pAdapter = NULL; + ULONG adaptOutBufLen; - _tprintf(_T("\tHostName. . . . . . . . . . . : %s\n"), pFixedInfo->HostName); - _tprintf(_T("\tDomainName. . . . . . . . . . : %s\n"), pFixedInfo->DomainName); + PFIXED_INFO pFixedInfo; + ULONG netOutBufLen; + PIP_ADDR_STRING pIPAddr; - _tprintf(_T("\tDNS Servers . . . . . . . . . : %s\n"), pFixedInfo->DnsServerList.IpAddress.String); - pIPAddr = pFixedInfo->DnsServerList.Next; - while (pIPAddr) { - _tprintf(_T("\t\t\t\t : %s\n"), pIPAddr->IpAddress.String); - pIPAddr = pIPAddr->Next; - } + /* assign memory for call to GetNetworkParams */ + pFixedInfo = (FIXED_INFO *) GlobalAlloc( GPTR, sizeof( FIXED_INFO ) ); + netOutBufLen = sizeof(FIXED_INFO); - _tprintf(_T("\tNodeType. . . . . . . . . . . : %d (%s)\n"), pFixedInfo->NodeType, GetNodeTypeName(pFixedInfo->NodeType)); - _tprintf(_T("\tScopeId . . . . . . . . . . . : %s\n"), pFixedInfo->ScopeId); - _tprintf(_T("\tEnableRouting . . . . . . . . : %s\n"), pFixedInfo->EnableRouting ? _T("yes") : _T("no")); - _tprintf(_T("\tEnableProxy . . . . . . . . . : %s\n"), pFixedInfo->EnableProxy ? _T("yes") : _T("no")); - _tprintf(_T("\tEnableDns . . . . . . . . . . : %s\n"), pFixedInfo->EnableDns ? _T("yes") : _T("no")); - _tprintf(_T("\n")); -/* - _tprintf(_T("\n"),); - _tprintf(_T("GetNetworkParams() returned with %d\n"), pIfTable->NumAdapters); + /* assign memory for call to GetAdapterInfo */ + pAdapterInfo = (IP_ADAPTER_INFO *) malloc( sizeof(IP_ADAPTER_INFO) ); + adaptOutBufLen = sizeof(IP_ADAPTER_INFO); - _tprintf(_T("\tConnection specific DNS suffix: %s\n"), pFixedInfo->EnableDns ? _T("yes") : _T("no")); -*/ - } else { - switch (result) { - case ERROR_BUFFER_OVERFLOW: - _tprintf(_T("The buffer size indicated by the pOutBufLen parameter is too small to hold the adapter information. The pOutBufLen parameter points to the required size\n")); - break; - case ERROR_INVALID_PARAMETER: - _tprintf(_T("The pOutBufLen parameter is NULL, or the calling process does not have read/write access to the memory pointed to by pOutBufLen, or the calling process does not have write access to the memory pointed to by the pAdapterInfo parameter\n")); - break; - case ERROR_NO_DATA: - _tprintf(_T("No adapter information exists for the local computer\n")); - break; - case ERROR_NOT_SUPPORTED: - _tprintf(_T("This function is not supported on the operating system in use on the local system\n")); - break; - default: - _tprintf(_T("0x%08lX - Use FormatMessage to obtain the message string for the returned error\n"), result); - break; - } + /* set required buffer size */ + if(GetNetworkParams(pFixedInfo, &netOutBufLen) == ERROR_BUFFER_OVERFLOW) + { + GlobalFree(pFixedInfo); + pFixedInfo = (FIXED_INFO *) GlobalAlloc(GPTR, netOutBufLen); } -} -static void ShowNetworkInterfaces() -{ - IP_INTERFACE_INFO* pIfTable = NULL; - DWORD result; - DWORD dwNumIf; - DWORD dwOutBufLen = 0; - - if ((result = GetNumberOfInterfaces(&dwNumIf)) != NO_ERROR) { - _tprintf(_T("GetNumberOfInterfaces() failed with code 0x%08lX - Use FormatMessage to obtain the message string for the returned error\n"), result); - return; - } else { - _tprintf(_T("GetNumberOfInterfaces() returned %lu\n"), dwNumIf); + /* set required buffer size */ + if (GetAdaptersInfo( pAdapterInfo, &adaptOutBufLen) == ERROR_BUFFER_OVERFLOW) + { + free(pAdapterInfo); + pAdapterInfo = (IP_ADAPTER_INFO *) malloc (adaptOutBufLen); } - result = GetInterfaceInfo(pIfTable, &dwOutBufLen); -/* - dwOutBufLen = sizeof(IP_INTERFACE_INFO) + dwNumIf * sizeof(IP_ADAPTER_INDEX_MAP); - _tprintf(_T("GetNumberOfInterfaces() returned %d, dwOutBufLen %d\n"), dwNumIf, dwOutBufLen); - _tprintf(_T("sizeof(IP_INTERFACE_INFO) %d, sizeof(IP_ADAPTER_INDEX_MAP) %d\n"), sizeof(IP_INTERFACE_INFO), sizeof(IP_ADAPTER_INDEX_MAP)); -*/ - pIfTable = (IP_INTERFACE_INFO*)malloc(dwOutBufLen); - if (!pIfTable) { - _tprintf(_T("ERROR: failed to allocate 0x%08lX bytes of memory\n"), dwOutBufLen); - return; - } -/* -typedef struct _IP_ADAPTER_INDEX_MAP { - ULONG Index; // adapter index - WCHAR Name[MAX_ADAPTER_NAME]; // name of the adapter -} IP_ADAPTER_INDEX_MAP, * PIP_ADAPTER_INDEX_MAP; + if (GetAdaptersInfo(pAdapterInfo, &adaptOutBufLen) == NO_ERROR) + { + if (GetNetworkParams(pFixedInfo, &netOutBufLen) == NO_ERROR) + { + pAdapter = pAdapterInfo; + //HKEY hKey; + //LPCTSTR lpSubKey = _T("SYSTEM\\ControlSet\\Control\\Network"); -typedef struct _IP_INTERFACE_INFO { - LONG NumAdapters; // number of adapters in array - IP_ADAPTER_INDEX_MAP Adapter[1]; // adapter indices and names -} IP_INTERFACE_INFO,*PIP_INTERFACE_INFO; - */ - result = GetInterfaceInfo(pIfTable, &dwOutBufLen); - if (result == NO_ERROR) { - INT i; - _tprintf(_T("GetInterfaceInfo() returned with %ld adaptor entries\n"), pIfTable->NumAdapters); - for (i = 0; i < pIfTable->NumAdapters; i++) { - wprintf(L"[%d] %s\n", i + 1, pIfTable->Adapter[i].Name); - /*wprintf(L"[%d] %s\n", pIfTable->Adapter[i].Index, pIfTable->Adapter[i].Name);*/ + _tprintf(_T("\nReactOS IP Configuration\n\n")); -/*HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\Parameters \Interfaces\Tcpip_{DB0E61C1-3498-4C5F-B599-59CDE8A1E357}*/ + if (bAll) + { + _tprintf(_T("\tHost Name . . . . . . . . . . . . : %s\n"), pFixedInfo->HostName); + _tprintf(_T("\tPrimary DNS Suffix. . . . . . . . : \n")); + _tprintf(_T("\tNode Type . . . . . . . . . . . . : %s\n"), GetNodeTypeName(pFixedInfo->NodeType)); + if (pFixedInfo->EnableRouting) + _tprintf(_T("\tIP Routing Enabled. . . . . . . . : Yes\n")); + else + _tprintf(_T("\tIP Routing Enabled. . . . . . . . : No\n")); + if (pAdapter->HaveWins) + _tprintf(_T("\tWINS Proxy enabled. . . . . . . . : Yes\n")); + else + _tprintf(_T("\tWINS Proxy enabled. . . . . . . . : No\n")); + _tprintf(_T("\tDNS Suffix Search List. . . . . . : %s\n"), pFixedInfo->DomainName); } - } else { - switch (result) { - case ERROR_INVALID_PARAMETER: - _tprintf(_T("The dwOutBufLen parameter is NULL, or GetInterfaceInterface is unable to write to the memory pointed to by the dwOutBufLen parameter\n")); - break; - case ERROR_INSUFFICIENT_BUFFER: - _tprintf(_T("The buffer pointed to by the pIfTable parameter is not large enough. The required size is returned in the DWORD variable pointed to by the dwOutBufLen parameter\n")); - _tprintf(_T("\tdwOutBufLen: %lu\n"), dwOutBufLen); - break; - case ERROR_NOT_SUPPORTED: - _tprintf(_T("This function is not supported on the operating system in use on the local system\n")); - break; - default: - _tprintf(_T("0x%08lX - Use FormatMessage to obtain the message string for the returned error\n"), result); - break; + + _tprintf(_T("\n%s Local Area Connection: \n\n"), GetInterfaceTypeName(pAdapter->Type)); + _tprintf(_T("\tConnection-specific DNS Suffix. . : %s\n"), pFixedInfo->DomainName); + + if (bAll) + { + _tprintf(_T("\tDescription . . . . . . . . . . . : %s\n"), pAdapter->Description); + _tprintf(_T("\tPhysical Address. . . . . . . . . : %s\n"), PrintMacAddr(pAdapter->Address)); + if (pAdapter->DhcpEnabled) + _tprintf(_T("\tDHCP Enabled. . . . . . . . . . . : Yes\n")); + else + _tprintf(_T("\tDHCP Enabled. . . . . . . . . . . : No\n")); + _tprintf(_T("\tAutoconfiguration Enabled . . . . : \n")); } + + _tprintf(_T("\tIP Address. . . . . . . . . . . . : %s\n"), pAdapter->IpAddressList.IpAddress.String); + _tprintf(_T("\tSubnet Mask . . . . . . . . . . . : %s\n"), pAdapter->IpAddressList.IpMask.String); + _tprintf(_T("\tDefault Gateway . . . . . . . . . : %s\n"), pAdapter->GatewayList.IpAddress.String); + + if (bAll) + { + if (pAdapter->DhcpEnabled) + _tprintf(_T("\tDHCP Server . . . . . . . . . . . : %s\n"), pAdapter->DhcpServer.IpAddress.String); + + _tprintf(_T("\tDNS Servers . . . . . . . . . . . : ")); + _tprintf(_T("%s\n"), pFixedInfo->DnsServerList.IpAddress.String); + pIPAddr = pFixedInfo -> DnsServerList.Next; + while (pIPAddr) + { + _tprintf(_T("\t\t\t\t\t %s\n"), pIPAddr ->IpAddress.String ); + pIPAddr = pIPAddr ->Next; + } + if (pAdapter->HaveWins) + { + _tprintf(_T("\tPrimary WINS Server . . . . . . . : %s\n"), pAdapter->PrimaryWinsServer.IpAddress.String); + _tprintf(_T("\tSecondard WINS Server . . . . . . : %s\n"), pAdapter->SecondaryWinsServer.IpAddress.String); + } + if (pAdapter->DhcpEnabled) + { + _tprintf(_T("\tLease Obtained. . . . . . . . . . : %s"), _tasctime(localtime(&pAdapter->LeaseObtained))); + _tprintf(_T("\tLease Expires . . . . . . . . . . : %s"), _tasctime(localtime(&pAdapter->LeaseExpires))); + } + } + _tprintf(_T("\n")); } - free(pIfTable); + else + _tprintf(_T("Call to GetNetworkParams failed.\n")); + + } + else + _tprintf(_T("Call to GetAdaptersInfo failed.\n")); + + return 0; } -/* -typedef struct _IP_ADAPTER_INFO { - struct _IP_ADAPTER_INFO* Next; - DWORD ComboIndex; - char AdapterName[MAX_ADAPTER_NAME_LENGTH + 4]; -1 char Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4]; - UINT AddressLength; -2 BYTE Address[MAX_ADAPTER_ADDRESS_LENGTH]; - DWORD Index; - UINT Type; -3 UINT DhcpEnabled; -5 PIP_ADDR_STRING CurrentIpAddress; - IP_ADDR_STRING IpAddressList; -7 IP_ADDR_STRING GatewayList; -8 IP_ADDR_STRING DhcpServer; - BOOL HaveWins; - IP_ADDR_STRING PrimaryWinsServer; - IP_ADDR_STRING SecondaryWinsServer; -a time_t LeaseObtained; -b time_t LeaseExpires; -} IP_ADAPTER_INFO, *PIP_ADAPTER_INFO; - */ -/* -Ethernet adapter VMware Virtual Ethernet Adapter (Network Address Translation (NAT) for VMnet8): - - Connection-specific DNS Suffix . : -1 Description . . . . . . . . . . . : VMware Virtual Ethernet Adapter (Network Address Translation (NAT) for VMnet8) -2 Physical Address. . . . . . . . . : 00-50-56-C0-00-08 -3 DHCP Enabled. . . . . . . . . . . : Yes - Autoconfiguration Enabled . . . . : Yes -5 IP Address. . . . . . . . . . . . : 192.168.136.1 - Subnet Mask . . . . . . . . . . . : 255.255.255.0 -7 Default Gateway . . . . . . . . . : -8 DHCP Server . . . . . . . . . . . : 192.168.136.254 - DNS Servers . . . . . . . . . . . : -a Lease Obtained. . . . . . . . . . : Monday, 30 December 2002 5:56:53 PM -b Lease Expires . . . . . . . . . . : Monday, 30 December 2002 6:26:53 PM - */ -static void ShowAdapterInfo(BOOL ShowAll) +INT Release(TCHAR Index) { - IP_ADAPTER_INFO* pAdaptorInfo; - ULONG ulOutBufLen; - DWORD dwRetVal; - PIP_ADDR_STRING pIpAddrString; - struct tm *LeaseTime; + IP_ADAPTER_INDEX_MAP AdapterInfo; + DWORD dwRetVal = 0; + /* if interface is not given, query GetInterfaceInfo */ + if (Index == (TCHAR)NULL) + { + PIP_INTERFACE_INFO pInfo; + pInfo = (IP_INTERFACE_INFO *) malloc(sizeof(IP_INTERFACE_INFO)); + ULONG ulOutBufLen = 0; - if (ShowAll) + /* Make an initial call to GetInterfaceInfo to get + * the necessary size into the ulOutBufLen variable */ + if ( GetInterfaceInfo(pInfo, &ulOutBufLen) == ERROR_INSUFFICIENT_BUFFER) + { + GlobalFree(pInfo); + pInfo = (IP_INTERFACE_INFO *) malloc (ulOutBufLen); + } + + /* Make a second call to GetInterfaceInfo to get the actual data we want */ + if ((dwRetVal = GetInterfaceInfo(pInfo, &ulOutBufLen)) == NO_ERROR ) + { + AdapterInfo = pInfo->Adapter[0]; + _tprintf(_T("name - %S\n"), pInfo->Adapter[0].Name); + } + else + { + _tprintf(_T("\nGetInterfaceInfo failed : ")); + DoFormatMessage(dwRetVal); + } + } + else { - _tprintf(_T("\nAdaptor Information\t\n")); + ; + /* we need to be able to release connections by name with support for globbing + * i.e. ipconfig /release Eth* will release all cards starting with Eth... + * ipconfig /release *con* will release all cards with 'con' in their name + */ } - pAdaptorInfo = (IP_ADAPTER_INFO*)GlobalAlloc(GPTR, sizeof(IP_ADAPTER_INFO)); - ulOutBufLen = sizeof(IP_ADAPTER_INFO); - if (ERROR_BUFFER_OVERFLOW == GetAdaptersInfo(pAdaptorInfo, &ulOutBufLen)) { - GlobalFree(pAdaptorInfo); - pAdaptorInfo = (IP_ADAPTER_INFO*)GlobalAlloc(GPTR, ulOutBufLen); + /* Call IpReleaseAddress to release the IP address on the specified adapter. */ + if ((dwRetVal = IpReleaseAddress(&AdapterInfo)) != NO_ERROR) + { + _tprintf(_T("\nAn error occured while releasing interface %s : "), _T("*name*")); + DoFormatMessage(dwRetVal); } - if ((dwRetVal = GetAdaptersInfo(pAdaptorInfo, &ulOutBufLen))) { - _tprintf(_T("Call to GetAdaptersInfo failed. Return Value: 0x%08lx\n"), dwRetVal); - } else { - while (pAdaptorInfo) { + return 0; +} - /* print the type of interface before the Name of it */ - _tprintf(_T("\n%s Adapter %s:\n\n"), GetInterfaceTypeName(pAdaptorInfo->Type), pAdaptorInfo->AdapterName); - if (ShowAll) - { - _tprintf(_T("\tDescription. . . . . . : %s\n"), pAdaptorInfo->Description); - /* print the Physical address to the screen*/ - _tprintf(_T("\tPhysical Address . . . : ")); - PrintPhysicalAddr(pAdaptorInfo->Address, pAdaptorInfo->AddressLength); - /* Now the DHCP state */ - _tprintf(_T("\tDHCP Enabled . . . . . : %s\n"), pAdaptorInfo->DhcpEnabled ? _T("Yes") : _T("No")); - } - - /* IP Addresses/Netmasks, there may be more than one */ - pIpAddrString = &pAdaptorInfo->IpAddressList; +INT Renew(TCHAR Index) +{ + IP_ADAPTER_INDEX_MAP AdapterInfo; + DWORD dwRetVal = 0; - do{ - _tprintf(_T("\tIP Address . . . . . . : %s\n"), pIpAddrString->IpAddress.String); - _tprintf(_T("\tSubnet Mask. . . . . . : %s\n"), pIpAddrString->IpMask.String); - pIpAddrString = pIpAddrString->Next; - }while (pIpAddrString!=NULL); + /* if interface is not given, query GetInterfaceInfo */ + if (Index == (TCHAR)NULL) + { + PIP_INTERFACE_INFO pInfo; + pInfo = (IP_INTERFACE_INFO *) malloc(sizeof(IP_INTERFACE_INFO)); + ULONG ulOutBufLen = 0; - /* Default Gateway */ - pIpAddrString = &pAdaptorInfo->GatewayList; - _tprintf(_T("\tDefault Gateway. . . . : %s\n"), pIpAddrString->IpAddress.String); + /* Make an initial call to GetInterfaceInfo to get + * the necessary size into the ulOutBufLen variable */ + if ( GetInterfaceInfo(pInfo, &ulOutBufLen) == ERROR_INSUFFICIENT_BUFFER) + { + GlobalFree(pInfo); + pInfo = (IP_INTERFACE_INFO *) malloc (ulOutBufLen); + } - /* Print some stuff that is only relevant it dhcp is enabled */ - if((pAdaptorInfo->DhcpEnabled)&&(ShowAll)) - { - /* Display the DHCP server address */ - pIpAddrString = &pAdaptorInfo->DhcpServer; - _tprintf(_T("\tDHCP Server. . . . . . : %s\n"), pIpAddrString->IpAddress.String); + /* Make a second call to GetInterfaceInfo to get the actual data we want */ + if ((dwRetVal = GetInterfaceInfo(pInfo, &ulOutBufLen)) == NO_ERROR ) + { + AdapterInfo = pInfo->Adapter[0]; + _tprintf(_T("name - %S\n"), pInfo->Adapter[0].Name); + } else { + _tprintf(_T("\nGetInterfaceInfo failed : ")); + DoFormatMessage(dwRetVal); + } + } + else + { + ; + /* we need to be able to renew connections by name with support for globbing + * i.e. ipconfig /renew Eth* will renew all cards starting with Eth... + * ipconfig /renew *con* will renew all cards with 'con' in their name + */ + } - /* Display the Lease times*/ - LeaseTime = localtime(&pAdaptorInfo->LeaseObtained); - _tprintf(_T("\tLease Obtained . . . . : %s"), asctime(LeaseTime)); - LeaseTime = localtime(&pAdaptorInfo->LeaseExpires); - _tprintf(_T("\tLease Expieres . . . . : %s"), asctime(LeaseTime)); + /* Call IpRenewAddress to renew the IP address on the specified adapter. */ + if ((dwRetVal = IpRenewAddress(&AdapterInfo)) != NO_ERROR) + { + _tprintf(_T("\nAn error occured while renew interface %s : "), _T("*name*")); + DoFormatMessage(dwRetVal); + } + return 0; +} - } +/* temp func for testing purposes */ +VOID Info() +{ + // Declare and initialize variables + PIP_INTERFACE_INFO pInfo; + pInfo = (IP_INTERFACE_INFO *) malloc( sizeof(IP_INTERFACE_INFO) ); + ULONG ulOutBufLen = sizeof(IP_INTERFACE_INFO); + DWORD dwRetVal = 0; - pAdaptorInfo = pAdaptorInfo->Next; + + // Make an initial call to GetInterfaceInfo to get + // the necessary size in the ulOutBufLen variable + if ( GetInterfaceInfo(pInfo, &ulOutBufLen) == ERROR_INSUFFICIENT_BUFFER) + { + free(pInfo); + pInfo = (IP_INTERFACE_INFO *) malloc (ulOutBufLen); + } + + // Make a second call to GetInterfaceInfo to get + // the actual data we need + if ((dwRetVal = GetInterfaceInfo(pInfo, &ulOutBufLen)) == NO_ERROR ) + { + int i; + for (i=0; i<pInfo->NumAdapters; i++) + { + printf("\tAdapter Name: %S\n", pInfo->Adapter[i].Name); + printf("\tAdapter Index: %ld\n", pInfo->Adapter[i].Index); + printf("\tNum Adapters: %ld\n", pInfo->NumAdapters); } } + else + { + printf("GetInterfaceInfo failed.\n"); + DoFormatMessage(dwRetVal); + } } -const TCHAR szUsage[] = { _T("USAGE:\n" \ - " ipconfig [/? | /all | /release [adapter] | /renew [adapter]\n" \ - " | /flushdns | /registerdns\n" \ - " | /showclassid adapter\n" \ - " | /showclassid adapter\n" \ - " | /setclassid adapter [classidtoset] ]\n" \ - "\n" \ - "adapter Full name or pattern with '*' and '?' to 'match',\n" \ - " * matches any character, ? matches one character.\n" \ - " Options\n" \ - " /? Display this help message.\n" \ - " /all Display full configuration information.\n" \ - " /release Release the IP address for the specified adapter.\n" \ - " /renew Renew the IP address for the specified adapter.\n" \ - " /flushdns Purges the DNS Resolver cache.\n" \ - " /registerdns Refreshes all DHCP leases and re-registers DNS names\n" \ - " /displaydns Display the contents of the DNS Resolver Cache.\n" \ - " /showclassid Displays all the dhcp class IDs allowed for adapter.\n" \ - " /setclassid Modifies the dhcp class id.\n" \ - "\n" \ - "The default is to display only the IP address, subnet mask and\n" \ - "default gateway for each adapter bound to TCP/IP.\n") -}; -/* - "\n" \ - "For Release and Renew, if no adapter name is specified, then the IP address\n" \ - "leases for all adapters bound to TCP/IP will be released or renewed.\n" \ - "\n" \ - "For SetClassID, if no class id is specified, then the classid is removed.\n" \ - "\n" \ - "Examples:\n" \ - " > ipconfig ... Show information.\n" \ - " > ipconfig /all ... Show detailed information\n" \ - " > ipconfig /renew ... renew all adapaters\n" \ - " > ipconfig /renew EL* ... renew adapters named EL....\n" \ - " > ipconfig /release *ELINK?21* ... release all matching adapters,\n" \ - eg. ELINK-21, myELELINKi21adapter.\n" - */ -static void usage(void) +VOID Usage(VOID) { - _fputts(szUsage, stderr); + _tprintf(_T("\nUSAGE:\n" + " ipconfig [/? | /all | /renew [adapter] | /release [adapter] |\n" + " /flushdns | /displaydns | /registerdns |\n" + " /showclassid adapter |\n" + " /setclassid adapter [classid] ]\n" + "\n" + "where\n" + " adapter Connection name\n" + " (wildcard characters * and ? allowed, see examples)\n" + "\n" + " Options:\n" + " /? Display this help message\n" + " /all Display full configuration information.\n" + " /release Release the IP address for the specified adapter.\n" + " /renew Renew the IP address for the specified adapter.\n" + " /flushdns Purges the DNS Resolver cache.\n" + " /registerdns Refreshes all DHCP leases and re-registers DNS names.\n" + " /displaydns Display the contents of the DNS Resolver Cache.\n" + " /showclassid Displays all the dhcp class IDs allowed for adapter.\n" + " /setclassid Modifies the dhcp class id.\n" + "\n" + "The default is to display only the IP address, subnet mask and\n" + "default gateway for each adapter bound to TCP/IP.\n" + "\n" + "For Release and Renew, if no adapter name is specified, then the IP address\n" + "leases for all adapters bound to TCP/IP will be released or renewed.\n" + "\n" + "For Setclassid, if no ClassId is specified, then the ClassId is removed.\n" + "\n" + "Examples:\n" + " > ipconfig ... Show information.\n" + " > ipconfig /all ... Show detailed information\n" + " > ipconfig /renew ... renew all adapters\n" + " > ipconfig /renew EL* ... renew any connection that has its\n" + " name starting with EL\n" + " > ipconfig /release *Con* ... release all matching connections,\n" + " eg. \"Local Area Connection 1\" or\n" + " \"Local Area Connection 2\"\n")); } - -int _tmain(int argc, TCHAR *argv[]) +int main(int argc, char *argv[]) { BOOL DoUsage=FALSE; BOOL DoAll=FALSE; @@ -384,14 +400,10 @@ BOOL DoRegisterdns=FALSE; BOOL DoDisplaydns=FALSE; BOOL DoShowclassid=FALSE; - BOOL DoSetclassid=FALSE; + BOOL DoSetclassid=FALSE; - _tprintf(_T("\nReactOS IP Configuration\n\n")); - - /* - Parse command line for options we have been given. - */ - if ( ((argc > 1))&&((argv[1][0]=='/')||(argv[1][0]=='-')) ) + /* Parse command line for options we have been given. */ + if ( (argc > 1)&&(argv[1][0]=='/') ) { if( !_tcsicmp( &argv[1][1], _T("?") )) { @@ -400,11 +412,11 @@ else if( !_tcsnicmp( &argv[1][1], _T("ALL"), _tcslen(&argv[1][1]) )) { DoAll = TRUE; - } + } else if( !_tcsnicmp( &argv[1][1], _T("RELEASE"), _tcslen(&argv[1][1]) )) { - DoRelease = TRUE; - } + DoRelease = TRUE; + } else if( ! _tcsnicmp( &argv[1][1], _T("RENEW"), _tcslen(&argv[1][1]) )) { DoRenew = TRUE; @@ -413,7 +425,7 @@ { DoFlushdns = TRUE; } - else if( ! _tcsnicmp( &argv[1][1], _T("REGISTERDNS"), _tcslen(&argv[1][1]) )) + else if( ! _tcsnicmp( &argv[1][1], _T("FLUSHREGISTERDNS"), _tcslen(&argv[1][1]) )) { DoRegisterdns = TRUE; } @@ -431,52 +443,50 @@ } } - - switch (argc) + switch (argc) { - case 1: /* Default behaviour if options are given specified*/ - ShowAdapterInfo(FALSE); + case 1: /* Default behaviour if no options are given*/ + ShowInfo(FALSE); break; case 2: /* Process all the options that take no paramiters */ - if ( DoUsage) - usage(); - else if ( DoAll) - { - ShowNetworkFixedInfo(); - ShowNetworkInterfaces(); - ShowAdapterInfo(TRUE); - } - else if ( DoRelease) - printf("\nSorry /Release is not implemented yet\n"); - else if ( DoRenew) - printf("\nSorry /Renew is not implemented yet\n"); - else if ( DoFlushdns) - printf("\nSorry /Flushdns is not implemented yet\n"); - else if ( DoRegisterdns) - printf("\nSorry /Registerdns is not implemented yet\n"); - else if ( DoDisplaydns) - printf("\nSorry /Displaydns is not implemented yet\n"); + if (DoUsage) + Usage(); + else if (DoAll) + ShowInfo(TRUE); + else if (DoRelease) + Release((TCHAR)NULL); + else if (DoRenew) + Renew((TCHAR)NULL); + else if (DoFlushdns) + _tprintf(_T("\nSorry /flushdns is not implemented yet\n")); + else if (DoRegisterdns) + _tprintf(_T("\nSorry /registerdns is not implemented yet\n")); + else if (DoDisplaydns) + _tprintf(_T("\nSorry /displaydns is not implemented yet\n")); else - usage(); + Usage(); break; case 3: /* Process all the options that can have 1 paramiters */ - if ( DoRelease) - printf("\nSorry /Release is not implemented yet\n"); - else if ( DoRenew) - printf("\nSorry /Renew is not implemented yet\n"); - else if ( DoShowclassid) - printf("\nSorry /Showclassid is not implemented yet\n"); + if (DoRelease) + _tprintf(_T("\nSorry /release [adapter] is not implemented yet\n")); + //Release(argv[2]); + else if (DoRenew) + _tprintf(_T("\nSorry /renew [adapter] is not implemented yet\n")); + else if (DoShowclassid) + _tprintf(_T("\nSorry /showclassid adapter is not implemented yet\n")); + else if (DoSetclassid) + _tprintf(_T("\nSorry /setclassid adapter is not implemented yet\n")); else - usage(); + Usage(); break; case 4: /* Process all the options that can have 2 paramiters */ - if ( DoSetclassid) - printf("\nSorry /Setclassid is not implemented yet\n"); + if (DoSetclassid) + _tprintf(_T("\nSorry /setclassid adapter [classid]is not implemented yet\n")); else - usage(); + Usage(); break; default: - usage(); + Usage(); } return 0; _____ Modified: trunk/reactos/apps/utils/net/ipconfig/ipconfig.rc --- trunk/reactos/apps/utils/net/ipconfig/ipconfig.rc 2005-10-27 22:33:17 UTC (rev 18813) +++ trunk/reactos/apps/utils/net/ipconfig/ipconfig.rc 2005-10-27 23:13:04 UTC (rev 18814) @@ -1,6 +1,5 @@ -/* $Id$ */ - -#define REACTOS_STR_FILE_DESCRIPTION "ReactOS TCP/IPv4 Win32 ipconfig\0" -#define REACTOS_STR_INTERNAL_NAME "ipconfig\0" -#define REACTOS_STR_ORIGINAL_FILENAME "ipconfig.exe\0" +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS TCP/IPv4 Win32 ipconfig\0" +#define REACTOS_STR_INTERNAL_NAME "ipconfig\0" +#define REACTOS_STR_ORIGINAL_FILENAME "ipconfig.exe\0" +#define REACTOS_STR_ORIGINAL_COPYRIGHT "Ged Murphy (gedmurphy(a)gmail.com)\0" #include <reactos/version.rc> _____ Modified: trunk/reactos/apps/utils/net/ipconfig/ipconfig.xml --- trunk/reactos/apps/utils/net/ipconfig/ipconfig.xml 2005-10-27 22:33:17 UTC (rev 18813) +++ trunk/reactos/apps/utils/net/ipconfig/ipconfig.xml 2005-10-27 23:13:04 UTC (rev 18814) @@ -1,10 +1,9 @@ <module name="ipconfig" type="win32cui" installbase="system32" installname="ipconfig.exe" allowwarnings="true"> - <include base="ipconfig">.</include> - <define name="__USE_W32API" /> - <library>kernel32</library> - <library>user32</library> - <library>iphlpapi</library> - <file>ipconfig.c</file> - <file>trace.c</file> - <file>ipconfig.rc</file> + <include base="ipconfig">.</include> + <define name="__USE_W32API" /> + <library>kernel32</library> + <library>user32</library> + <library>iphlpapi</library> + <file>ipconfig.c</file> + <file>ipconfig.rc</file> </module> _____ Deleted: trunk/reactos/apps/utils/net/ipconfig/trace.c --- trunk/reactos/apps/utils/net/ipconfig/trace.c 2005-10-27 22:33:17 UTC (rev 18813) +++ trunk/reactos/apps/utils/net/ipconfig/trace.c 2005-10-27 23:13:04 UTC (rev 18814) @@ -1,53 +0,0 @@ -/////////////////////////////////////////////////////////////////////// ////// -// Diagnostic Trace -// -#include <stdio.h> -#include <stdarg.h> -#define WIN32_LEAN_AND_MEAN -#include <windows.h> -#include <tchar.h> -#include "trace.h" - - -#ifdef _DEBUG - -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; - -void _DebugBreak(void) -{ - DebugBreak(); -} - -void Trace(TCHAR* lpszFormat, ...) -{ - va_list args; - int nBuf; - TCHAR szBuffer[512]; - - va_start(args, lpszFormat); - nBuf = _vsntprintf(szBuffer, sizeof(szBuffer)/sizeof(TCHAR), lpszFormat, args); - OutputDebugString(szBuffer); - // was there an error? was the expanded string too long? - //ASSERT(nBuf >= 0); - va_end(args); -} - -void Assert(void* assert, TCHAR* file, int line, void* msg) -{ - if (msg == NULL) { - printf("ASSERT -- %s occured on line %u of file %s.\n", - assert, line, file); - } else { - printf("ASSERT -- %s occured on line %u of file %s: Message = %s.\n", - assert, line, file, msg); - } -} - -#else - -void Trace(TCHAR* lpszFormat, ...) { }; -void Assert(void* assert, TCHAR* file, int line, void* msg) { }; - -#endif //_DEBUG -/////////////////////////////////////////////////////////////////////// ////// _____ Deleted: trunk/reactos/apps/utils/net/ipconfig/trace.h --- trunk/reactos/apps/utils/net/ipconfig/trace.h 2005-10-27 22:33:17 UTC (rev 18813) +++ trunk/reactos/apps/utils/net/ipconfig/trace.h 2005-10-27 23:13:04 UTC (rev 18814) @@ -1,61 +0,0 @@ -/////////////////////////////////////////////////////////////////////// ////// -// Diagnostic Trace -// -#ifndef __TRACE_H__ -#define __TRACE_H__ - -#ifdef _DEBUG - -#ifdef _X86_ -#define BreakPoint() _asm { int 3h } -#else -#define BreakPoint() _DebugBreak() -#endif - -#ifndef ASSERT -#define ASSERT(exp) \ -{ \ - if (!(exp)) { \ - Assert(#exp, __FILE__, __LINE__, NULL); \ - BreakPoint(); \ - } \ -} \ - -#define ASSERTMSG(exp, msg) \ -{ \ - if (!(exp)) { \ - Assert(#exp, __FILE__, __LINE__, msg); \ - BreakPoint(); \ - } \ -} -#endif - -//===================================================================== ======== -// MACRO: TRACE() -//===================================================================== ======== - -#define TRACE Trace - - -#else // _DEBUG - -//===================================================================== ======== -// Define away MACRO's ASSERT() and TRACE() in non debug builds -//===================================================================== ======== - -#ifndef ASSERT -#define ASSERT(exp) -#define ASSERTMSG(exp, msg) -#endif - -#define TRACE 0 ? (void)0 : Trace - -#endif // !_DEBUG - - -void Assert(void* assert, TCHAR* file, int line, void* msg); -void Trace(TCHAR* lpszFormat, ...); - - -#endif // __TRACE_H__ -/////////////////////////////////////////////////////////////////////// //////
19 years, 1 month
1
0
0
0
[weiden] 18813: integrate the reboot dialog into the wizard
by weiden@svn.reactos.com
integrate the reboot dialog into the wizard Modified: trunk/reactos/lib/syssetup/install.c Modified: trunk/reactos/lib/syssetup/resource.h Modified: trunk/reactos/lib/syssetup/syssetup_Cz.rc Modified: trunk/reactos/lib/syssetup/syssetup_De.rc Modified: trunk/reactos/lib/syssetup/syssetup_En.rc Modified: trunk/reactos/lib/syssetup/syssetup_Fr.rc Modified: trunk/reactos/lib/syssetup/syssetup_Ja.rc Modified: trunk/reactos/lib/syssetup/syssetup_Nl.rc Modified: trunk/reactos/lib/syssetup/wizard.c _____ Modified: trunk/reactos/lib/syssetup/install.c --- trunk/reactos/lib/syssetup/install.c 2005-10-27 22:16:52 UTC (rev 18812) +++ trunk/reactos/lib/syssetup/install.c 2005-10-27 22:33:17 UTC (rev 18813) @@ -50,9 +50,7 @@ #include "globals.h" #include "resource.h" -#define VMWINST - /* GLOBALS ******************************************************************/ PSID DomainSid = NULL; @@ -80,30 +78,6 @@ } -#ifdef VMWINST -static BOOL -RunVMWInstall(VOID) -{ - PROCESS_INFORMATION ProcInfo; - STARTUPINFO si; - WCHAR InstallName[] = L"vmwinst.exe"; - - ZeroMemory(&si, sizeof(STARTUPINFO)); - si.cb = sizeof(STARTUPINFO); - - if(CreateProcess(NULL, InstallName, NULL, NULL, TRUE, NORMAL_PRIORITY_CLASS, - NULL, NULL, &si, &ProcInfo)) - { - WaitForSingleObject(ProcInfo.hProcess, INFINITE); - CloseHandle(ProcInfo.hThread); - CloseHandle(ProcInfo.hProcess); - return TRUE; - } - return FALSE; -} -#endif - - HRESULT CreateShellLink(LPCTSTR linkPath, LPCTSTR cmd, LPCTSTR arg, LPCTSTR dir, LPCTSTR iconPath, int icon_nr, LPCTSTR comment) { IShellLink* psl; @@ -561,15 +535,6 @@ SetupCloseInfFile(hSysSetupInf); -#ifdef VMWINST - RunVMWInstall(); -#endif - - DialogBox(hDllInstance, - MAKEINTRESOURCE(IDD_RESTART), - NULL, - RestartDlgProc); - return 0; } _____ Modified: trunk/reactos/lib/syssetup/resource.h --- trunk/reactos/lib/syssetup/resource.h 2005-10-27 22:16:52 UTC (rev 18812) +++ trunk/reactos/lib/syssetup/resource.h 2005-10-27 22:33:17 UTC (rev 18813) @@ -57,11 +57,8 @@ #define IDD_FINISHPAGE 1070 #define IDC_FINISHTITLE 1071 +#define IDC_RESTART_PROGRESS 1072 - -#define IDD_RESTART 2000 -#define IDC_RESTART_PROGRESS 2001 - #define IDD_GPL 2100 #define IDC_GPL_TEXT 2101 _____ Modified: trunk/reactos/lib/syssetup/syssetup_Cz.rc --- trunk/reactos/lib/syssetup/syssetup_Cz.rc 2005-10-27 22:16:52 UTC (rev 18812) +++ trunk/reactos/lib/syssetup/syssetup_Cz.rc 2005-10-27 22:33:17 UTC (rev 18813) @@ -144,24 +144,12 @@ LTEXT "Completing the ReactOS Setup Wizard",IDC_FINISHTITLE,115,9,195,37 LTEXT "You have successfully completed ReactOS Setup.\n\n" \ "When you click Finish, your computer will restart.", IDC_STATIC, 115, 58, 195, 100 + CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 115, 138, 188, 12 LTEXT "If there is a CD in a drive, remove it. Then, to restart "\ "your computer, click Finish.", IDC_STATIC, 115, 160, 195, 31 END -IDD_RESTART DIALOG 6, 18, 245, 116 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION -CAPTION "Instatalace ReactOSu" -FONT 8, "MS Shell Dlg" -BEGIN - LTEXT "Instalace ReactOSu byla ·spýÜný dokonÞena.", -1, 13, 12, 212, 16 - LTEXT "Pro pokraÞovßnÝ pot°ebuje instalaÞnÝ program restartovat VßÜ poÞÝtaÞ. PoÞÝtaÞ bude automaticky restartovßn za 15 sekund nebo zmßÞknete-li tlaÞÝtko Restartovat.", -1, 13, 33, 212, 32 -/* GROUPBOX "", -1, 7, 3, 231, 106 */ - CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 13, 70, 212, 8 - PUSHBUTTON "&Restartovat", IDOK, 98, 87, 50, 14 -END - - IDD_GPL DIALOG 0, 0, 333, 230 STYLE DS_CENTER | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "GNU General Public License" _____ Modified: trunk/reactos/lib/syssetup/syssetup_De.rc --- trunk/reactos/lib/syssetup/syssetup_De.rc 2005-10-27 22:16:52 UTC (rev 18812) +++ trunk/reactos/lib/syssetup/syssetup_De.rc 2005-10-27 22:33:17 UTC (rev 18813) @@ -146,26 +146,12 @@ LTEXT "Fertigstellung des ReactOS Setup Assistenten",IDC_FINISHTITLE,115,9,195,37 LTEXT "Das ReactOS Setup wurde erfolgreich fertiggestellt.\n\n" \ "Wenn Sie auf Fertig klicken, wird der Computer neu gestartet.", IDC_STATIC, 115, 58, 195, 100 + CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 115, 138, 188, 12 LTEXT "Entfernen Sie die CD, wenn vorhanden. Danach klicken Sie "\ "auf Fertig, um den Computer neu zu starten.", IDC_STATIC, 115, 160, 195, 31 END -IDD_RESTART DIALOG 6, 18, 245, 116 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION -CAPTION "ReactOS Installation" -FONT 8, "MS Shell Dlg" -BEGIN - LTEXT "Die Installation von ReactOS wurde erfolgreich fertiggestellt.", IDC_STATIC, 13, 12, 212, 16 - LTEXT "Um fortzufahren muss Ihr Computer neu gestartet werden. "\ - "Der Computer wird in 15 Minuten automatisch neu gestartet oder wenn Sie auf "\ - "Neustart klicken.", IDC_STATIC, 13, 33, 212, 32 -/* GROUPBOX "", -1, 7, 3, 231, 106 */ - CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 13, 70, 212, 8 - PUSHBUTTON "&Neustart", IDOK, 98, 87, 50, 14 -END - - IDD_GPL DIALOG 0, 0, 333, 230 STYLE DS_CENTER | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "GNU General Public License" _____ Modified: trunk/reactos/lib/syssetup/syssetup_En.rc --- trunk/reactos/lib/syssetup/syssetup_En.rc 2005-10-27 22:16:52 UTC (rev 18812) +++ trunk/reactos/lib/syssetup/syssetup_En.rc 2005-10-27 22:33:17 UTC (rev 18813) @@ -147,26 +147,12 @@ LTEXT "Completing the ReactOS Setup Wizard", IDC_FINISHTITLE, 115, 8, 195, 24 LTEXT "You have successfully completed ReactOS Setup.\n\n" \ "When you click Finish, your computer will restart.", IDC_STATIC, 115, 40, 195, 100 + CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 115, 138, 188, 12 LTEXT "If there is a CD in a drive, remove it. Then, to restart "\ "your computer, click Finish.", IDC_STATIC, 115, 169, 195, 17 END -IDD_RESTART DIALOG 6, 18, 245, 116 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION -CAPTION "ReactOS Installation" -FONT 8, "MS Shell Dlg" -BEGIN - LTEXT "Installation of ReactOS was successfully completed.", IDC_STATIC, 13, 12, 212, 16 - LTEXT "In order to continue, the installation program needs to restart your computer. "\ - "The computer will be automatically restarted in 15 seconds or if you press the "\ - "Restart button.", IDC_STATIC, 13, 33, 212, 32 -/* GROUPBOX "", -1, 7, 3, 231, 106 */ - CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 13, 70, 212, 8 - PUSHBUTTON "&Restart", IDOK, 98, 87, 50, 14 -END - - IDD_GPL DIALOG 0, 0, 333, 230 STYLE DS_CENTER | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "GNU General Public License" _____ Modified: trunk/reactos/lib/syssetup/syssetup_Fr.rc --- trunk/reactos/lib/syssetup/syssetup_Fr.rc 2005-10-27 22:16:52 UTC (rev 18812) +++ trunk/reactos/lib/syssetup/syssetup_Fr.rc 2005-10-27 22:33:17 UTC (rev 18813) @@ -147,26 +147,12 @@ LTEXT "L'assistant d'installation de ReactOS est terminÚ.",IDC_FINISHTITLE,115,9,195,37 LTEXT "Vous avez installÚ avec succÞs ReactOS.\n\n" \ "En cliquant sur Terminer, votre ordinateur va redÚmarrer.", IDC_STATIC, 115, 58, 195, 100 + CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 115, 138, 188, 12 LTEXT "S'il y a un CD dans un lecteur, enlevez-le. Puis, pour redÚmarrer "\ "votre ordinateur, cliquez sur Terminer.", IDC_STATIC, 115, 160, 195, 31 END -IDD_RESTART DIALOG 6, 18, 245, 116 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION -CAPTION "Installation de ReactOS" -FONT 8, "MS Shell Dlg" -BEGIN - LTEXT "L'assistant d'installation de ReactOS est terminÚ.", IDC_STATIC, 13, 12, 212, 16 - LTEXT "Pour continuer, l'assistant a besoin de redÚmarrer votre ordinateur. "\ - "L'ordinateur redÚmarrera automatiquement dans 15 secondes, ou quand vous appuyerez "\ - "sur le bouton RedÚmarrer.", IDC_STATIC, 13, 33, 212, 32 -/* GROUPBOX "", -1, 7, 3, 231, 106 */ - CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 13, 70, 212, 8 - PUSHBUTTON "&RedÚmarrer", IDOK, 98, 87, 50, 14 -END - - IDD_GPL DIALOG 0, 0, 333, 230 STYLE DS_CENTER | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "GNU General Public License" _____ Modified: trunk/reactos/lib/syssetup/syssetup_Ja.rc --- trunk/reactos/lib/syssetup/syssetup_Ja.rc 2005-10-27 22:16:52 UTC (rev 18812) +++ trunk/reactos/lib/syssetup/syssetup_Ja.rc 2005-10-27 22:33:17 UTC (rev 18813) @@ -147,26 +147,12 @@ LTEXT "ReactOS âZâbâgâAâbâv âEâBâUü[âhé¬è«ù?éÁé?éÁé¢", IDC_FINISHTITLE, 115, 8, 195, 24 LTEXT "ReactOS âZâbâgâAâbâvé¬É?ÅÝé?è«ù?éÁé?éÁé¢üB\n\n" \ "[è«ù?] éâNâèâbâNéÀéÚéãüAâRâôâsâàü[â^éì?ïNô«éÁé?éÀüB", IDC_STATIC, 115, 40, 195, 100 + CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 115, 138, 188, 12 LTEXT "âhâëâCâué? CD é¬ô³é?é?éóéÚÅÛìçé?üACD éĵéÞÅoéÁé?é¡é¥é? éóüBCD éĵéÞÅoéÁ"\ "é¢éþüA[è«ù?] éâNâèâbâNéÁé?âRâôâsâàü[â^éì?ïNô«éÁé?é¡é¥é? éóüB", IDC_STATIC, 115, 169, 195, 17 END -IDD_RESTART DIALOG 6, 18, 245, 116 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION -CAPTION "ReactOS é?âCâôâXâgü[âï" -FONT 9, "MS UI Gothic" -BEGIN - LTEXT "ReactOS é?É?ÅÝé?âCâôâXâgü[âïé?éÛé?éÁé¢üB", IDC_STATIC, 13, 12, 212, 16 - LTEXT "âCâôâXâgü[âï âvâìâOâëâÇéæ?é»éÚé?é?üAâRâôâsâàü[â^éì? ïNô«éÀéÚòKùvé¬éáéÞé?éÀüB"\ - "âRâôâsâàü[â^é? 15 òbîÒé?Ä®ô«ôIé?ì?ïNô«éÁé?éÀüBìíéÀé«ì? ïNô«éÀéÚé?é?"\ - "[ì?ïNô«] â{â^âôéâNâèâbâNéÁé?é¡é¥é?éóüB", IDC_STATIC, 13, 33, 212, 32 -/* GROUPBOX "", -1, 7, 3, 231, 106 */ - CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 13, 70, 212, 8 - PUSHBUTTON "ì?ïNô«(&R)", IDOK, 98, 87, 50, 14 -END - - IDD_GPL DIALOG 0, 0, 333, 230 STYLE DS_CENTER | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "GNU General Public License" _____ Modified: trunk/reactos/lib/syssetup/syssetup_Nl.rc --- trunk/reactos/lib/syssetup/syssetup_Nl.rc 2005-10-27 22:16:52 UTC (rev 18812) +++ trunk/reactos/lib/syssetup/syssetup_Nl.rc 2005-10-27 22:33:17 UTC (rev 18813) @@ -147,26 +147,12 @@ LTEXT "Completing the ReactOS Setup Wizard", IDC_FINISHTITLE, 115, 8, 195, 24 LTEXT "You have successfully completed ReactOS Setup.\n\n" \ "When you click Finish, your computer will restart.", IDC_STATIC, 115, 40, 195, 100 + CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 115, 138, 188, 12 LTEXT "If there is a CD in a drive, remove it. Then, to restart "\ "your computer, click Finish.", IDC_STATIC, 115, 169, 195, 17 END -IDD_RESTART DIALOG 6, 18, 245, 116 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION -CAPTION "ReactOS Installation" -FONT 8, "MS Shell Dlg" -BEGIN - LTEXT "Installation of ReactOS was successfully completed.", IDC_STATIC, 13, 12, 212, 16 - LTEXT "In order to continue, the installation program needs to restart your computer. "\ - "The computer will be automatically restarted in 15 seconds or if you press the "\ - "Restart button.", IDC_STATIC, 13, 33, 212, 32 -/* GROUPBOX "", -1, 7, 3, 231, 106 */ - CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 13, 70, 212, 8 - PUSHBUTTON "&Restart", IDOK, 98, 87, 50, 14 -END - - IDD_GPL DIALOG 0, 0, 333, 230 STYLE DS_CENTER | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "GNU General Public License" _____ Modified: trunk/reactos/lib/syssetup/wizard.c --- trunk/reactos/lib/syssetup/wizard.c 2005-10-27 22:16:52 UTC (rev 18812) +++ trunk/reactos/lib/syssetup/wizard.c 2005-10-27 22:33:17 UTC (rev 18813) @@ -38,6 +38,7 @@ #include "globals.h" #include "resource.h" +#define VMWINST /* GLOBALS ******************************************************************/ @@ -46,6 +47,47 @@ /* FUNCTIONS ****************************************************************/ +#ifdef VMWINST +static BOOL +RunVMWInstall(HWND hWnd) +{ + PROCESS_INFORMATION ProcInfo; + MSG msg; + DWORD ret; + STARTUPINFO si = {0}; + WCHAR InstallName[] = L"vmwinst.exe"; + + si.cb = sizeof(STARTUPINFO); + + if(CreateProcess(NULL, InstallName, NULL, NULL, TRUE, NORMAL_PRIORITY_CLASS, + NULL, NULL, &si, &ProcInfo)) + { + EnableWindow(hWnd, FALSE); + for (;;) + { + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) + { + if (msg.message == WM_QUIT) + goto done; + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + ret = MsgWaitForMultipleObjects(1, &ProcInfo.hProcess, FALSE, INFINITE, QS_ALLEVENTS | QS_ALLINPUT); + if (ret == WAIT_OBJECT_0) + break; + } +done: + EnableWindow(hWnd, TRUE); + + CloseHandle(ProcInfo.hThread); + CloseHandle(ProcInfo.hProcess); + return TRUE; + } + return FALSE; +} +#endif + static VOID CenterWindow(HWND hWnd) { @@ -96,7 +138,7 @@ } -INT_PTR CALLBACK +static INT_PTR CALLBACK GplDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, @@ -165,7 +207,7 @@ } -INT_PTR CALLBACK +static INT_PTR CALLBACK WelcomeDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, @@ -231,7 +273,7 @@ } -INT_PTR CALLBACK +static INT_PTR CALLBACK AckPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, @@ -323,7 +365,7 @@ } -INT_PTR CALLBACK +static INT_PTR CALLBACK OwnerPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, @@ -413,7 +455,7 @@ } -INT_PTR CALLBACK +static INT_PTR CALLBACK ComputerPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, @@ -576,8 +618,8 @@ static VOID RunInputLocalePage(HWND hwnd) { - PROPSHEETPAGE psp; - PROPSHEETHEADER psh; + PROPSHEETPAGE psp = {0}; + PROPSHEETHEADER psh = {0}; HMODULE hDll; // TCHAR Caption[256]; @@ -585,7 +627,6 @@ if (hDll == NULL) return; - ZeroMemory(&psp, sizeof(PROPSHEETPAGE)); psp.dwSize = sizeof(PROPSHEETPAGE); psp.dwFlags = PSP_DEFAULT; psp.hInstance = hDll; @@ -594,7 +635,6 @@ // LoadString(hDll, IDS_CPLNAME, Caption, sizeof(Caption) / sizeof(TCHAR)); - ZeroMemory(&psh, sizeof(PROPSHEETHEADER)); psh.dwSize = sizeof(PROPSHEETHEADER); psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE; // psh.hwndParent = hwnd; @@ -611,7 +651,7 @@ } -INT_PTR CALLBACK +static INT_PTR CALLBACK LocalePageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, @@ -1178,7 +1218,7 @@ } -INT_PTR CALLBACK +static INT_PTR CALLBACK DateTimePageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, @@ -1252,7 +1292,7 @@ } -INT_PTR CALLBACK +static INT_PTR CALLBACK ProcessPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, @@ -1280,12 +1320,24 @@ hWndProgress = GetDlgItem(hwndDlg, IDC_PROCESSPROGRESS); Position = SendMessage(hWndProgress, PBM_GETPOS, 0, 0); - if (Position == 300) + if (Position == 2) { + KillTimer(hwndDlg, 1); + + /* Enable the Back and Next buttons */ + PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT); PropSheet_PressButton(GetParent(hwndDlg), PSBTN_NEXT); } else { +#ifdef VMWINST + if (Position == 1) + { + KillTimer(hwndDlg, 1); + RunVMWInstall(GetParent(hwndDlg)); + SetTimer(hwndDlg, 1, 50, NULL); + } +#endif SendMessage(hWndProgress, PBM_SETPOS, Position + 1, 0); } } @@ -1302,14 +1354,11 @@ PropSheet_SetWizButtons(GetParent(hwndDlg), 0); SendDlgItemMessage(hwndDlg, IDC_PROCESSPROGRESS, PBM_SETRANGE, 0, - MAKELPARAM(0, 300)); + MAKELPARAM(0, 2)); SetTimer(hwndDlg, 1, 50, NULL); break; case PSN_WIZNEXT: - - /* Enable the Back and Next buttons */ - PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT); break; default: @@ -1327,7 +1376,7 @@ -INT_PTR CALLBACK +static INT_PTR CALLBACK FinishDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, @@ -1352,6 +1401,25 @@ } break; + case WM_TIMER: + { + INT Position; + HWND hWndProgress; + + hWndProgress = GetDlgItem(hwndDlg, IDC_RESTART_PROGRESS); + Position = SendMessage(hWndProgress, PBM_GETPOS, 0, 0); + if (Position == 300) + { + KillTimer(hwndDlg, 1); + PropSheet_PressButton(GetParent(hwndDlg), PSBTN_FINISH); + } + else + { + SendMessage(hWndProgress, PBM_SETPOS, Position + 1, 0); + } + } + return TRUE; + case WM_NOTIFY: { LPNMHDR lpnm = (LPNMHDR)lParam; @@ -1361,12 +1429,22 @@ case PSN_SETACTIVE: /* Enable the correct buttons on for the active page */ PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_FINISH); + + SendDlgItemMessage(hwndDlg, IDC_RESTART_PROGRESS, PBM_SETRANGE, 0, + MAKELPARAM(0, 300)); + SendDlgItemMessage(hwndDlg, IDC_RESTART_PROGRESS, PBM_SETPOS, 0, 0); + SetTimer(hwndDlg, 1, 50, NULL); break; case PSN_WIZBACK: /* Handle a Back button click, if necessary */ - break; + KillTimer(hwndDlg, 1); + /* Skip the progress page */ + PropSheet_SetCurSelByID(GetParent(hwndDlg), IDD_DATETIMEPAGE); + SetWindowLong(hwndDlg, DWL_MSGRESULT, -1); + return TRUE; + case PSN_WIZFINISH: /* Handle a Finish button click, if necessary */ break; @@ -1390,20 +1468,20 @@ { PROPSHEETHEADER psh; HPROPSHEETPAGE ahpsp[8]; - PROPSHEETPAGE psp; + PROPSHEETPAGE psp = {0}; + UINT nPages = 0; /* Clear setup data */ ZeroMemory(&SetupData, sizeof(SETUPDATA)); /* Create the Welcome page */ - ZeroMemory (&psp, sizeof(PROPSHEETPAGE)); psp.dwSize = sizeof(PROPSHEETPAGE); psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER; psp.hInstance = hDllInstance; psp.lParam = (LPARAM)&SetupData; psp.pfnDlgProc = WelcomeDlgProc; psp.pszTemplate = MAKEINTRESOURCE(IDD_WELCOMEPAGE); - ahpsp[0] = CreatePropertySheetPage(&psp); + ahpsp[nPages++] = CreatePropertySheetPage(&psp); /* Create the Acknowledgements page */ psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; @@ -1411,7 +1489,7 @@ psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_ACKSUBTITLE); psp.pszTemplate = MAKEINTRESOURCE(IDD_ACKPAGE); psp.pfnDlgProc = AckPageDlgProc; - ahpsp[1] = CreatePropertySheetPage(&psp); + ahpsp[nPages++] = CreatePropertySheetPage(&psp); /* Create the Owner page */ psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; @@ -1419,7 +1497,7 @@ psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_OWNERSUBTITLE); psp.pszTemplate = MAKEINTRESOURCE(IDD_OWNERPAGE); psp.pfnDlgProc = OwnerPageDlgProc; - ahpsp[2] = CreatePropertySheetPage(&psp); + ahpsp[nPages++] = CreatePropertySheetPage(&psp); /* Create the Computer page */ psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; @@ -1427,7 +1505,7 @@ psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_COMPUTERSUBTITLE); psp.pfnDlgProc = ComputerPageDlgProc; psp.pszTemplate = MAKEINTRESOURCE(IDD_COMPUTERPAGE); - ahpsp[3] = CreatePropertySheetPage(&psp); + ahpsp[nPages++] = CreatePropertySheetPage(&psp); /* Create the Locale page */ @@ -1436,7 +1514,7 @@ psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_LOCALESUBTITLE); psp.pfnDlgProc = LocalePageDlgProc; psp.pszTemplate = MAKEINTRESOURCE(IDD_LOCALEPAGE); - ahpsp[4] = CreatePropertySheetPage(&psp); + ahpsp[nPages++] = CreatePropertySheetPage(&psp); /* Create the DateTime page */ @@ -1445,32 +1523,30 @@ psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_DATETIMESUBTITLE); psp.pfnDlgProc = DateTimePageDlgProc; psp.pszTemplate = MAKEINTRESOURCE(IDD_DATETIMEPAGE); - ahpsp[5] = CreatePropertySheetPage(&psp); + ahpsp[nPages++] = CreatePropertySheetPage(&psp); /* Create the Process page */ -#if 0 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_PROCESSTITLE); psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_PROCESSSUBTITLE); psp.pfnDlgProc = ProcessPageDlgProc; psp.pszTemplate = MAKEINTRESOURCE(IDD_PROCESSPAGE); - ahpsp[6] = CreatePropertySheetPage(&psp); -#endif + ahpsp[nPages++] = CreatePropertySheetPage(&psp); /* Create the Finish page */ psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER; psp.pfnDlgProc = FinishDlgProc; psp.pszTemplate = MAKEINTRESOURCE(IDD_FINISHPAGE); - ahpsp[6] = CreatePropertySheetPage(&psp); + ahpsp[nPages++] = CreatePropertySheetPage(&psp); /* Create the property sheet */ psh.dwSize = sizeof(PROPSHEETHEADER); psh.dwFlags = PSH_WIZARD97 | PSH_WATERMARK | PSH_HEADER; psh.hInstance = hDllInstance; psh.hwndParent = NULL; - psh.nPages = 7; + psh.nPages = nPages; psh.nStartPage = 0; psh.phpage = ahpsp; psh.pszbmWatermark = MAKEINTRESOURCE(IDB_WATERMARK);
19 years, 1 month
1
0
0
0
[gedmurphy] 18812: Add the beginnings of sc.exe
by gedmurphy@svn.reactos.com
Add the beginnings of sc.exe Very early stages and completley untested. Not adding to build. Putting in SVN for the sole reason of keeping a development log Added: trunk/reactos/subsys/system/sc/ Added: trunk/reactos/subsys/system/sc/manage.c Added: trunk/reactos/subsys/system/sc/query.c Added: trunk/reactos/subsys/system/sc/sc.c Added: trunk/reactos/subsys/system/sc/sc.h Added: trunk/reactos/subsys/system/sc/sc.rc Added: trunk/reactos/subsys/system/sc/sc.xml Added: trunk/reactos/subsys/system/sc/usage.c _____ Added: trunk/reactos/subsys/system/sc/manage.c --- trunk/reactos/subsys/system/sc/manage.c 2005-10-27 22:10:33 UTC (rev 18811) +++ trunk/reactos/subsys/system/sc/manage.c 2005-10-27 22:16:52 UTC (rev 18812) @@ -0,0 +1,121 @@ +#include "sc.h" + +extern SC_HANDLE hSCManager; // declared in sc.c + +BOOL Start(INT ArgCount, TCHAR **Args) +{ + SC_HANDLE hSc; + LPCTSTR ServiceName = *Args++; + LPCTSTR *ServiceArgs = &*Args; + + hSc = OpenService(hSCManager, ServiceName, SERVICE_ALL_ACCESS); + + if (hSc == NULL) + { + dprintf("openService failed\n"); + ReportLastError(); + return FALSE; + } + + if (! StartService(hSc, ArgCount, ServiceArgs)) + { + dprintf("DeleteService failed\n"); + ReportLastError(); + return FALSE; + } + + CloseServiceHandle(hSc); + return TRUE; + +} + + +BOOL Create(TCHAR **Args) +{ + SC_HANDLE hSc; + LPCTSTR Name = *Args; + LPCTSTR BinaryPathName = *++Args; + + + hSc = CreateService(hSCManager, + Name, + Name, + SERVICE_ALL_ACCESS, + SERVICE_WIN32_OWN_PROCESS, + SERVICE_DEMAND_START, + SERVICE_ERROR_NORMAL, + BinaryPathName, + NULL, + NULL, + NULL, + NULL, + NULL); + + if (hSc == NULL) + { + dprintf("CreateService failed (%d)\n"); + ReportLastError(); + return FALSE; + } + else + { + CloseServiceHandle(hSc); + return TRUE; + } +} + +BOOL Delete(TCHAR **Args) +{ + SC_HANDLE hSc; + LPCTSTR ServiceName = *Args; + + hSc = OpenService(hSCManager, ServiceName, DELETE); + + if (hSc == NULL) + { + dprintf("openService failed\n"); + ReportLastError(); + return FALSE; + } + + if (! DeleteService(hSc)) + { + dprintf("DeleteService failed\n"); + ReportLastError(); + return FALSE; + } + + CloseServiceHandle(hSc); + return TRUE; +} + + +BOOL Control(DWORD Control, TCHAR **Args) +{ + SC_HANDLE hSc; + SERVICE_STATUS Status; + LPCTSTR ServiceName = *Args; + + + hSc = OpenService(hSCManager, ServiceName, DELETE); + + if (hSc == NULL) + { + dprintf("openService failed\n"); + ReportLastError(); + return FALSE; + } + + if (! ControlService(hSc, Control, &Status)) + { + dprintf("controlService failed\n"); + ReportLastError(); + return FALSE; + } + + CloseServiceHandle(hSc); + return TRUE; + +} + + Property changes on: trunk/reactos/subsys/system/sc/manage.c ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native _____ Added: trunk/reactos/subsys/system/sc/query.c --- trunk/reactos/subsys/system/sc/query.c 2005-10-27 22:10:33 UTC (rev 18811) +++ trunk/reactos/subsys/system/sc/query.c 2005-10-27 22:16:52 UTC (rev 18812) @@ -0,0 +1,107 @@ +#include "sc.h" + +extern SC_HANDLE hSCManager; /* declared in sc.c */ + +BOOL +Query(TCHAR **Args, BOOL bExtended) +{ + SC_HANDLE hSc; + ENUM_SERVICE_STATUS_PROCESS *pServiceStatus = NULL; + DWORD BufSize = 0; + DWORD BytesNeeded; + DWORD NumServices; + DWORD ResumeHandle; + INT i; + + /* determine required buffer size */ + EnumServicesStatusEx(hSCManager, + SC_ENUM_PROCESS_INFO, + SERVICE_DRIVER | SERVICE_WIN32, + SERVICE_STATE_ALL, + (LPBYTE)pServiceStatus, + BufSize, + &BytesNeeded, + &NumServices, + &ResumeHandle, + 0); + + /* exit on failure */ + if (GetLastError() != ERROR_MORE_DATA) + { + ReportLastError(); + return FALSE; + } + + /* reserve memory for service info array */ + pServiceStatus = (ENUM_SERVICE_STATUS_PROCESS *) malloc(BytesNeeded); + + /* fill array with service info */ + if (! EnumServicesStatusEx(hSCManager, + SC_ENUM_PROCESS_INFO, + SERVICE_DRIVER | SERVICE_WIN32, + SERVICE_STATE_ALL, + (LPBYTE)pServiceStatus, + BufSize, + &BytesNeeded, + &NumServices, + &ResumeHandle, + 0)) + { + dprintf("Call to EnumServicesStatusEx failed : "); + ReportLastError(); + return FALSE; + } +/* + for (i=0; i<NumServices; i++) + { + if (Args == NULL) + { + if (pServiceStatus[i]->dwServiceType == SERVICE_WIN32 && + pServiceStatus[i]->dwServiceState == SERVICE_ACTIVE) + PrintService(pServiceStatus[i], bExtended); + continue; + } + + if(_tcsicmp(Args[0], _T("type=")) + + else if(_tcsicmp(Args[0], _T("state=")) + + else if(_tcsicmp(Args[0], _T("bufsize=")) + + else if(_tcsicmp(Args[0], _T("ri=")) + + else if(_tcsicmp(Args[0], _T("group=")) + +*/ + + +} + + +VOID +PrintService(ENUM_SERVICE_STATUS_PROCESS *pServiceStatus, + BOOL bExtended) +{ + dprintf("SERVICE_NAME: %s\n", pServiceStatus->lpServiceName); + dprintf("DISPLAY_NAME: %s\n", pServiceStatus->lpDisplayName); + dprintf("TYPE : %lu\n", + pServiceStatus->ServiceStatusProcess.dwServiceType); + dprintf("STATE : %lu\n", + pServiceStatus->ServiceStatusProcess.dwCurrentState); + // (STOPPABLE,NOT_PAUSABLE,ACCEPTS_SHUTDOWN) + dprintf("WIN32_EXIT_CODE : %lu \n", + pServiceStatus->ServiceStatusProcess.dwWin32ExitCode); + dprintf("SERVICE_EXIT_CODE : %lu \n", + pServiceStatus->ServiceStatusProcess.dwServiceSpecificExitCode); + dprintf("CHECKPOINT : %lu\n", + pServiceStatus->ServiceStatusProcess.dwCheckPoint); + dprintf("WAIT_HINT : %lu\n", + pServiceStatus->ServiceStatusProcess.dwWaitHint); + if (bExtended) + { + dprintf("PID : %lu\n", + pServiceStatus->ServiceStatusProcess.dwProcessId); + dprintf("FLAGS : %lu\n", + pServiceStatus->ServiceStatusProcess.dwServiceFlags); + } +} Property changes on: trunk/reactos/subsys/system/sc/query.c ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native _____ Added: trunk/reactos/subsys/system/sc/sc.c --- trunk/reactos/subsys/system/sc/sc.c 2005-10-27 22:10:33 UTC (rev 18811) +++ trunk/reactos/subsys/system/sc/sc.c 2005-10-27 22:16:52 UTC (rev 18812) @@ -0,0 +1,138 @@ +#include "sc.h" + +HANDLE OutputHandle; +HANDLE InputHandle; + +SC_HANDLE hSCManager; + +VOID dprintf(TCHAR* fmt, ...) +{ + va_list args; + char buffer[255]; + + va_start(args, fmt); + wvsprintfA(buffer, fmt, args); + WriteConsole(OutputHandle, buffer, lstrlenA(buffer), NULL, NULL); + va_end(args); +} + +DWORD ReportLastError(VOID) +{ + LPVOID lpMsgBuf; + DWORD RetVal; + + DWORD ErrorCode = GetLastError(); + if (ErrorCode != ERROR_SUCCESS) + { + if ((RetVal = FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + ErrorCode, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */ + (LPTSTR) &lpMsgBuf, + 0, + NULL ))) + { + _tprintf(_T("%s"), (LPTSTR)lpMsgBuf); + + LocalFree(lpMsgBuf); + /* return number of TCHAR's stored in output buffer + * excluding '\0' - as FormatMessage does*/ + return RetVal; + } + } + return 0; +} + + +INT ScControl(LPTSTR MachineName, LPCTSTR Command, TCHAR **Args) +{ + + if (MachineName) + { + dprintf("Remote service control is not yet implemented\n"); + return 2; + } + + hSCManager = OpenSCManager(MachineName, NULL, SC_MANAGER_ALL_ACCESS); + if (hSCManager == NULL) + { + dprintf("[SC] OpenSCManager FAILED \n"); + ReportLastError(); + return -1; + } + + + if (_tcsicmp(Command, _T("query")) == 0) + Query(Args, FALSE); + + else if (_tcsicmp(Command, _T("queryex")) == 0) + Query(Args, TRUE); + + else if (_tcsicmp(Command, _T("start")) == 0) + { + /*if (! **Args) + StartUsage(); + else + Start(Args);*/ + } + else if (_tcsicmp(Command, _T("pause")) == 0) + Control(SERVICE_CONTROL_PAUSE, ++Args); + + else if (_tcsicmp(Command, _T("interrogate")) == 0) + Control(SERVICE_CONTROL_INTERROGATE, ++Args); + + else if (_tcsicmp(Command, _T("interrogate")) == 0) + Control(SERVICE_CONTROL_INTERROGATE, ++Args); + + else if (_tcsicmp(Command, _T("continue")) == 0) + Control(SERVICE_CONTROL_CONTINUE, ++Args); + + else if (_tcsicmp(Command, _T("delete")) == 0) + Delete(Args); + + else if (_tcsicmp(Command, _T("create")) == 0) + Create(Args); + + else if (_tcsicmp(Command, _T("control")) == 0) + Control((DWORD)NULL, Args); + + return 0; +} + + +int main(int argc, char* argv[]) +{ + LPTSTR MachineName = NULL; // remote machine + LPCTSTR Command = argv[1]; // sc command + TCHAR **Args = NULL; // rest of args + + /* initialize standard input / output and get handles */ + AllocConsole(); + InputHandle = GetStdHandle(STD_INPUT_HANDLE); + OutputHandle = GetStdHandle(STD_OUTPUT_HANDLE); + + if (argc < 2) + return MainUsage(); + + /* get server name */ + if ((argv[1][0] == '\\') && (argv[1][1] == '\\')) + { + if (argc < 3) + return MainUsage(); + + _tcscpy(MachineName, argv[1]); + Command = argv[2]; + Args = &argv[3]; + return ScControl(MachineName, Command, Args); + } + else + { + Args = &argv[2]; + return ScControl(MachineName, Command, Args); + } + + return MainUsage(); +} Property changes on: trunk/reactos/subsys/system/sc/sc.c ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native _____ Added: trunk/reactos/subsys/system/sc/sc.h --- trunk/reactos/subsys/system/sc/sc.h 2005-10-27 22:10:33 UTC (rev 18811) +++ trunk/reactos/subsys/system/sc/sc.h 2005-10-27 22:16:52 UTC (rev 18812) @@ -0,0 +1,21 @@ +#include <windows.h> +#include <stdio.h> +#include <tchar.h> + +DWORD ReportLastError(VOID); +VOID dprintf(TCHAR* fmt, ...); + +INT MainUsage(VOID); +INT StartUsage(VOID); +INT PauseUsage(VOID); +INT InterrogateUsage(VOID); +INT ContinueUsage(VOID); +INT StopUsage(VOID); +INT ConfigUsage(VOID); +INT DescriptionUsage(VOID); + +BOOL Query(TCHAR **Args, BOOL bExtended); +BOOL Start(INT ArgCount, TCHAR **Args); +BOOL Create(TCHAR **Args); +BOOL Delete(TCHAR **Args); +BOOL Control(DWORD Control, TCHAR **Args); Property changes on: trunk/reactos/subsys/system/sc/sc.h ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native _____ Added: trunk/reactos/subsys/system/sc/sc.rc --- trunk/reactos/subsys/system/sc/sc.rc 2005-10-27 22:10:33 UTC (rev 18811) +++ trunk/reactos/subsys/system/sc/sc.rc 2005-10-27 22:16:52 UTC (rev 18812) @@ -0,0 +1,4 @@ +#define REACTOS_STR_FILE_DESCRIPTION "Services control application\0" +#define REACTOS_STR_INTERNAL_NAME "sc\0" +#define REACTOS_STR_ORIGINAL_FILENAME "sc.exe\0" +#include <reactos/version.rc> _____ Added: trunk/reactos/subsys/system/sc/sc.xml --- trunk/reactos/subsys/system/sc/sc.xml 2005-10-27 22:10:33 UTC (rev 18811) +++ trunk/reactos/subsys/system/sc/sc.xml 2005-10-27 22:16:52 UTC (rev 18812) @@ -0,0 +1,10 @@ +<module name="sc" type="win32cui" installbase="system32" installname="sc.exe"> + <define name="__USE_W32API" /> + <define name="DEFINE_GUID" /> + <library>kernel32</library> + <file>sc.c</file> + <file>manage.c</file> + <file>query.c</file> + <file>usage.c</file> + <file>sc.rc</file> +</module> _____ Added: trunk/reactos/subsys/system/sc/usage.c --- trunk/reactos/subsys/system/sc/usage.c 2005-10-27 22:10:33 UTC (rev 18811) +++ trunk/reactos/subsys/system/sc/usage.c 2005-10-27 22:16:52 UTC (rev 18812) @@ -0,0 +1,116 @@ +#include "sc.h" + +INT MainUsage(VOID) +{ + dprintf("DESCRIPTION:\n"); + dprintf("\tSC is a command line program used for communicating with\n"); + dprintf("\tthe Service Control Manager and its services.\n"); + dprintf("USAGE:\n"); + dprintf("\tsc <server> [command] [service name] <option1> <option2>...\n"); + + dprintf("\tThe optional parameter <server> has the form \"\\ServerName\"\n"); + dprintf("\tFurther help on commands can be obtained by typing: \"sc [command]\"\n"); + dprintf("\tService Commands:\n"); + dprintf("\t query : Queries the status for a service, or\n"); + dprintf("\t enumerates the status for types of services.\n"); + dprintf("\t queryex : Queries the extended status for a service, or\n"); +// dprintf("\t enumerates the status for types of services.\n"); + dprintf("\t start : Starts a service.\n"); + dprintf("\t pause : Sends a PAUSE control request to a service.\n"); + dprintf("\t interrogate : Sends a INTERROGATE control request to a service.\n"); +// dprintf("\t continue : Sends a CONTINUE control request to a service.\n"); + dprintf("\t stop : Sends a STOP request to a service.\n"); +// dprintf("\t config : Changes the configuration of a service (persistant).\n"); +// dprintf("\t description : Changes the description of a service.\n"); +// dprintf("\t failure : Changes the actions taken by a service upon failure.\n"); +// dprintf("\t qc : Queries the configuration information for a service.\n"); +// dprintf("\t qdescription : Queries the description for a service.\n"); +// dprintf("\t qfailure : Queries the actions taken by a service upon failure.\n"); + dprintf("\t delete : Deletes a service (from the registry).\n"); + dprintf("\t create : Creates a service. (adds it to the registry).\n"); + dprintf("\t control : Sends a control to a service.\n"); +// dprintf("\t sdshow : Displays a service's security descriptor.\n"); +// dprintf("\t sdset : Sets a service's security descriptor.\n"); +// dprintf("\t GetDisplayName : Gets the DisplayName for a service.\n"); +// dprintf("\t GetKeyName : Gets the ServiceKeyName for a service.\n"); +// dprintf("\t EnumDepend : Enumerates Service Dependencies.\n"); +// dprintf("\n"); +// dprintf("\tService Name Independant Commands:\n"); +// dprintf("\t boot : (ok | bad) Indicates whether the last boot should\n"); +// dprintf("\t be saved as the last-known-good boot configuration\n"); +// dprintf("\t Lock : Locks the SCM Database\n"); +// dprintf("\t QueryLock : Queries the LockStatus for the SCM Database\n"); + + return 0; +} + + +INT StartUsage(VOID) +{ + dprintf("DESCRIPTION:\n"); + dprintf(" Starts a service running.\n"); + dprintf("USAGE:\n"); + dprintf(" sc <server> start [service name] <arg1> <arg2> ...\n"); + + return 0; +} + + +INT PauseUsage(VOID) +{ + dprintf("DESCRIPTION:\n"); + dprintf(" Sends a PAUSE control request to a service.\n"); + dprintf("USAGE:\n"); + dprintf(" sc <server> pause [service name]\n"); + + return 0; +} + +INT InterrogateUsage(VOID) +{ + dprintf("DESCRIPTION:\n"); + dprintf(" Sends an INTERROGATE control request to a service.\n"); + dprintf("USAGE:\n"); + dprintf(" sc <server> interrogate [service name]\n"); + + return 0; +} + + +INT ContinueUsage(VOID) +{ + dprintf("DESCRIPTION:\n"); + dprintf(" Sends an CONTINUE control request to a service.\n"); + dprintf("USAGE:\n"); + dprintf(" sc <server> continue [service name]\n"); + + return 0; +} + +INT StopUsage(VOID) +{ + dprintf("DESCRIPTION:\n"); + dprintf(" Sends an STOP control request to a service.\n"); + dprintf("USAGE:\n"); + dprintf(" sc <server> stop [service name]\n"); + + return 0; +} + +INT ConfigUsage(VOID) +{ + dprintf("not yet implemented\n"); + + return 0; +} + + +INT DescriptionUsage(VOID) +{ + dprintf("DESCRIPTION:\n"); + dprintf(" Sets the description string for a service.\n"); + dprintf("USAGE:\n"); + dprintf(" sc <server> description [service name]\n"); + + return 0; +} Property changes on: trunk/reactos/subsys/system/sc/usage.c ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native
19 years, 1 month
1
0
0
0
[greatlrd] 18811: Addin wine 0.9 dplay and dplayx it is directx core for network and tested in windows and not in reactos.
by greatlrd@svn.reactos.com
Addin wine 0.9 dplay and dplayx it is directx core for network and tested in windows and not in reactos. it is working in windows. Modified: trunk/reactos/lib/directory.xml Added: trunk/reactos/lib/dplay/ Added: trunk/reactos/lib/dplay/dplay.spec Added: trunk/reactos/lib/dplay/dplay.xml Added: trunk/reactos/lib/dplay/dplay_main.c Added: trunk/reactos/lib/dplay/version.rc Added: trunk/reactos/lib/dplayx/ Added: trunk/reactos/lib/dplayx/dpclassfactory.c Added: trunk/reactos/lib/dplayx/dpinit.h Added: trunk/reactos/lib/dplayx/dplay.c Added: trunk/reactos/lib/dplayx/dplay_global.h Added: trunk/reactos/lib/dplayx/dplaysp.c Added: trunk/reactos/lib/dplayx/dplaysp.h Added: trunk/reactos/lib/dplayx/dplayx.spec Added: trunk/reactos/lib/dplayx/dplayx.xml Added: trunk/reactos/lib/dplayx/dplayx_global.c Added: trunk/reactos/lib/dplayx/dplayx_global.h Added: trunk/reactos/lib/dplayx/dplayx_main.c Added: trunk/reactos/lib/dplayx/dplayx_messages.c Added: trunk/reactos/lib/dplayx/dplayx_messages.h Added: trunk/reactos/lib/dplayx/dplayx_queue.h Added: trunk/reactos/lib/dplayx/dplobby.c Added: trunk/reactos/lib/dplayx/lobbysp.c Added: trunk/reactos/lib/dplayx/lobbysp.h Added: trunk/reactos/lib/dplayx/name_server.c Added: trunk/reactos/lib/dplayx/name_server.h Added: trunk/reactos/lib/dplayx/regsvr.c Added: trunk/reactos/lib/dplayx/version.rc _____ Modified: trunk/reactos/lib/directory.xml --- trunk/reactos/lib/directory.xml 2005-10-27 22:05:46 UTC (rev 18810) +++ trunk/reactos/lib/directory.xml 2005-10-27 22:10:33 UTC (rev 18811) @@ -62,6 +62,12 @@ <directory name="dnsapi"> <xi:include href="dnsapi/dnsapi.xml" /> </directory> +<directory name="dplay"> + <xi:include href="dplay/dplay.xml" /> +</directory> +<directory name="dplayx"> + <xi:include href="dplayx/dplayx.xml" /> +</directory> <directory name="dsound"> <xi:include href="dsound/dsound.xml" /> </directory> _____ Added: trunk/reactos/lib/dplay/dplay.spec --- trunk/reactos/lib/dplay/dplay.spec 2005-10-27 22:05:46 UTC (rev 18810) +++ trunk/reactos/lib/dplay/dplay.spec 2005-10-27 22:10:33 UTC (rev 18811) @@ -0,0 +1,4 @@ +# First DirectPlay dll. Replaced by dplayx.dll. + +@ stdcall DirectPlayCreate(ptr ptr ptr) dplayx.DirectPlayCreate +@ stdcall DirectPlayEnumerate(ptr ptr) dplayx.DirectPlayEnumerate _____ Added: trunk/reactos/lib/dplay/dplay.xml --- trunk/reactos/lib/dplay/dplay.xml 2005-10-27 22:05:46 UTC (rev 18810) +++ trunk/reactos/lib/dplay/dplay.xml 2005-10-27 22:10:33 UTC (rev 18811) @@ -0,0 +1,25 @@ +<module name="dplay" type="win32dll" baseaddress="${BASEADDRESS_DPLAY}" installbase="system32" installname="dplay.dll"> + <importlibrary definition="dplay.spec.def" /> + <include base="dinput8">.</include> + <include base="ReactOS">include/wine</include> + <define name="UNICODE" /> + <define name="_UNICODE" /> + <define name="__REACTOS__" /> + <define name="__USE_W32API" /> + <define name="_WIN32_IE">0x600</define> + <define name="_WIN32_WINNT">0x501</define> + <define name="WINVER">0x501</define> + <library>wine</library> + <library>uuid</library> + <library>ntdll</library> + <library>kernel32</library> + <library>user32</library> + <library>advapi32</library> + <library>ole32</library> + <library>winmm</library> + <library>dxguid</library> + <library>dinput</library> + <file>version.rc</file> + <file>dplay_main.c</file> + <file>dplay.spec</file> +</module> _____ Added: trunk/reactos/lib/dplay/dplay_main.c --- trunk/reactos/lib/dplay/dplay_main.c 2005-10-27 22:05:46 UTC (rev 18810) +++ trunk/reactos/lib/dplay/dplay_main.c 2005-10-27 22:10:33 UTC (rev 18811) @@ -0,0 +1 @@ +/* nothing here yet */ _____ Added: trunk/reactos/lib/dplay/version.rc --- trunk/reactos/lib/dplay/version.rc 2005-10-27 22:05:46 UTC (rev 18810) +++ trunk/reactos/lib/dplay/version.rc 2005-10-27 22:10:33 UTC (rev 18811) @@ -0,0 +1,27 @@ +/* + * Copyright 2004 Tom Wickline + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#define WINE_OLESELFREGISTER +#define WINE_FILEDESCRIPTION_STR "Wine DirectPlay" +#define WINE_FILENAME_STR "dplay.dll" +#define WINE_FILEVERSION 5,3,0,900 +#define WINE_FILEVERSION_STR "5.3.0.900" +#define WINE_PRODUCTVERSION 5,3,0,900 +#define WINE_PRODUCTVERSION_STR "5.3" + +#include "wine/wine_common_ver.rc" _____ Added: trunk/reactos/lib/dplayx/dpclassfactory.c --- trunk/reactos/lib/dplayx/dpclassfactory.c 2005-10-27 22:05:46 UTC (rev 18810) +++ trunk/reactos/lib/dplayx/dpclassfactory.c 2005-10-27 22:10:33 UTC (rev 18811) @@ -0,0 +1,134 @@ +/* COM class factory for direct play lobby interfaces. + * + * Copyright 1999, 2000 Peter Hunnisett + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <stdarg.h> +#include <string.h> + +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "objbase.h" +#include "winerror.h" +#include "wine/debug.h" +#include "dpinit.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dplay); + + +/********************************************************************** ********* + * DirectPlayLobby ClassFactory + */ + +typedef struct +{ + /* IUnknown fields */ + const IClassFactoryVtbl *lpVtbl; + LONG ref; +} IClassFactoryImpl; + +static HRESULT WINAPI +DP_and_DPL_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) { + IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + + return E_NOINTERFACE; +} + +static ULONG WINAPI +DP_and_DPL_AddRef(LPCLASSFACTORY iface) { + IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + return InterlockedIncrement(&This->ref); +} + +static ULONG WINAPI DP_and_DPL_Release(LPCLASSFACTORY iface) { + IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + /* static class (reference starts @ 1), won't ever be freed */ + return InterlockedDecrement(&This->ref); +} + +static HRESULT WINAPI DP_and_DPL_CreateInstance( + LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj +) { + IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + + TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj); + + if ( DPL_CreateInterface( riid, ppobj ) == S_OK ) + { + return S_OK; + } + else if ( DP_CreateInterface( riid, ppobj ) == S_OK ) + { + return S_OK; + } + + return E_NOINTERFACE; +} + +static HRESULT WINAPI DP_and_DPL_LockServer(LPCLASSFACTORY iface,BOOL dolock) { + IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + FIXME("(%p)->(%d),stub!\n",This,dolock); + return S_OK; +} + +static const IClassFactoryVtbl DP_and_DPL_Vtbl = { + DP_and_DPL_QueryInterface, + DP_and_DPL_AddRef, + DP_and_DPL_Release, + DP_and_DPL_CreateInstance, + DP_and_DPL_LockServer +}; + +static IClassFactoryImpl DP_and_DPL_CF = {&DP_and_DPL_Vtbl, 1 }; + + +/********************************************************************** ********* + * DllGetClassObject [DPLAYX.@] + * Retrieves DP or DPL class object from a DLL object + * + * NOTES + * Docs say returns STDAPI + * + * PARAMS + * rclsid [I] CLSID for the class object + * riid [I] Reference to identifier of interface for class object + * ppv [O] Address of variable to receive interface pointer for riid + * + * RETURNS + * Success: S_OK + * Failure: CLASS_E_CLASSNOTAVAILABLE, E_OUTOFMEMORY, E_INVALIDARG, + * E_UNEXPECTED + */ +HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) +{ + TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); + + if ( IsEqualCLSID( riid, &IID_IClassFactory ) ) + { + *ppv = (LPVOID)&DP_and_DPL_CF; + IClassFactory_AddRef( (IClassFactory*)*ppv ); + + return S_OK; + } + + ERR("(%p,%p,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); + return CLASS_E_CLASSNOTAVAILABLE; +} _____ Added: trunk/reactos/lib/dplayx/dpinit.h --- trunk/reactos/lib/dplayx/dpinit.h 2005-10-27 22:05:46 UTC (rev 18810) +++ trunk/reactos/lib/dplayx/dpinit.h 2005-10-27 22:10:33 UTC (rev 18811) @@ -0,0 +1,37 @@ +/* + * Copyright 1999, 2000 Peter Hunnisett + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WINE_DPINIT_H +#define __WINE_DPINIT_H + +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" +#include "wtypes.h" +#include "dplay_global.h" + +extern HRESULT DP_CreateInterface( REFIID riid, LPVOID* ppvObj ); +extern HRESULT DPL_CreateInterface( REFIID riid, LPVOID* ppvObj ); +extern HRESULT DPSP_CreateInterface( REFIID riid, LPVOID* ppvObj, + IDirectPlay2Impl* dp ); +extern HRESULT DPLSP_CreateInterface( REFIID riid, LPVOID* ppvObj, + IDirectPlay2Impl* dp ); + + +#endif _____ Added: trunk/reactos/lib/dplayx/dplay.c --- trunk/reactos/lib/dplayx/dplay.c 2005-10-27 22:05:46 UTC (rev 18810) +++ trunk/reactos/lib/dplayx/dplay.c 2005-10-27 22:10:33 UTC (rev 18811) @@ -0,0 +1,5451 @@ +/* Direct Play 2,3,4 Implementation + * + * Copyright 1998,1999,2000,2001 - Peter Hunnisett + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" +#include "wine/port.h" + +#include <stdarg.h> +#include <string.h> + +#define NONAMELESSUNION +#define NONAMELESSSTRUCT +#include "windef.h" +#include "winerror.h" +#include "winbase.h" +#include "winnt.h" +#include "winreg.h" +#include "winnls.h" +#include "wine/unicode.h" +#include "wine/debug.h" + +#include "dpinit.h" +#include "dplayx_global.h" +#include "name_server.h" +#include "dplayx_queue.h" +#include "dplaysp.h" +#include "dplay_global.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dplay); + +/* FIXME: Should this be externed? */ +extern HRESULT DPL_CreateCompoundAddress +( LPCDPCOMPOUNDADDRESSELEMENT lpElements, DWORD dwElementCount, + LPVOID lpAddress, LPDWORD lpdwAddressSize, BOOL bAnsiInterface ); + + +/* Local function prototypes */ +static lpPlayerList DP_FindPlayer( IDirectPlay2AImpl* This, DPID dpid ); +static lpPlayerData DP_CreatePlayer( IDirectPlay2Impl* iface, LPDPID lpid, + LPDPNAME lpName, DWORD dwFlags, + HANDLE hEvent, BOOL bAnsi ); +static BOOL DP_CopyDPNAMEStruct( LPDPNAME lpDst, LPDPNAME lpSrc, BOOL bAnsi ); +static void DP_SetPlayerData( lpPlayerData lpPData, DWORD dwFlags, + LPVOID lpData, DWORD dwDataSize ); + +static lpGroupData DP_CreateGroup( IDirectPlay2AImpl* iface, LPDPID lpid, + LPDPNAME lpName, DWORD dwFlags, + DPID idParent, BOOL bAnsi ); +static void DP_SetGroupData( lpGroupData lpGData, DWORD dwFlags, + LPVOID lpData, DWORD dwDataSize ); +static void DP_DeleteDPNameStruct( LPDPNAME lpDPName ); +static void DP_DeletePlayer( IDirectPlay2Impl* This, DPID dpid ); +static BOOL CALLBACK cbDeletePlayerFromAllGroups( DPID dpId, + DWORD dwPlayerType, + LPCDPNAME lpName, + DWORD dwFlags, + LPVOID lpContext ); +static lpGroupData DP_FindAnyGroup( IDirectPlay2AImpl* This, DPID dpid ); +static BOOL CALLBACK cbRemoveGroupOrPlayer( DPID dpId, DWORD dwPlayerType, + LPCDPNAME lpName, DWORD dwFlags, + LPVOID lpContext ); +static void DP_DeleteGroup( IDirectPlay2Impl* This, DPID dpid ); + +/* Forward declarations of virtual tables */ +static const IDirectPlay2Vtbl directPlay2AVT; +static const IDirectPlay3Vtbl directPlay3AVT; +static const IDirectPlay4Vtbl directPlay4AVT; + +static const IDirectPlay2Vtbl directPlay2WVT; +static const IDirectPlay3Vtbl directPlay3WVT; +static const IDirectPlay4Vtbl directPlay4WVT; + +/* Helper methods for player/group interfaces */ +static HRESULT WINAPI DP_IF_DeletePlayerFromGroup + ( IDirectPlay2Impl* This, LPVOID lpMsgHdr, DPID idGroup, + DPID idPlayer, BOOL bAnsi ); +static HRESULT WINAPI DP_IF_CreatePlayer + ( IDirectPlay2Impl* This, LPVOID lpMsgHdr, LPDPID lpidPlayer, + LPDPNAME lpPlayerName, HANDLE hEvent, LPVOID lpData, + DWORD dwDataSize, DWORD dwFlags, BOOL bAnsi ); +static HRESULT WINAPI DP_IF_DestroyGroup + ( IDirectPlay2Impl* This, LPVOID lpMsgHdr, DPID idGroup, BOOL bAnsi ); +static HRESULT WINAPI DP_IF_DestroyPlayer + ( IDirectPlay2Impl* This, LPVOID lpMsgHdr, DPID idPlayer, BOOL bAnsi ); +static HRESULT WINAPI DP_IF_EnumGroupPlayers + ( IDirectPlay2Impl* This, DPID idGroup, LPGUID lpguidInstance, + LPDPENUMPLAYERSCALLBACK2 lpEnumPlayersCallback2, + LPVOID lpContext, DWORD dwFlags, BOOL bAnsi ); +static HRESULT WINAPI DP_IF_EnumGroups + ( IDirectPlay2Impl* This, LPGUID lpguidInstance, + LPDPENUMPLAYERSCALLBACK2 lpEnumPlayersCallback2, + LPVOID lpContext, DWORD dwFlags, BOOL bAnsi ); +static HRESULT WINAPI DP_IF_EnumPlayers + ( IDirectPlay2Impl* This, LPGUID lpguidInstance, + LPDPENUMPLAYERSCALLBACK2 lpEnumPlayersCallback2, + LPVOID lpContext, DWORD dwFlags, BOOL bAnsi ); +static HRESULT WINAPI DP_IF_GetGroupData + ( IDirectPlay2Impl* This, DPID idGroup, LPVOID lpData, + LPDWORD lpdwDataSize, DWORD dwFlags, BOOL bAnsi ); +static HRESULT WINAPI DP_IF_GetGroupName + ( IDirectPlay2Impl* This, DPID idGroup, LPVOID lpData, + LPDWORD lpdwDataSize, BOOL bAnsi ); +static HRESULT WINAPI DP_IF_GetPlayerData + ( IDirectPlay2Impl* This, DPID idPlayer, LPVOID lpData, + LPDWORD lpdwDataSize, DWORD dwFlags, BOOL bAnsi ); +static HRESULT WINAPI DP_IF_GetPlayerName + ( IDirectPlay2Impl* This, DPID idPlayer, LPVOID lpData, + LPDWORD lpdwDataSize, BOOL bAnsi ); +static HRESULT WINAPI DP_IF_SetGroupName + ( IDirectPlay2Impl* This, DPID idGroup, LPDPNAME lpGroupName, + DWORD dwFlags, BOOL bAnsi ); +static HRESULT WINAPI DP_IF_SetPlayerData + ( IDirectPlay2Impl* This, DPID idPlayer, LPVOID lpData, + DWORD dwDataSize, DWORD dwFlags, BOOL bAnsi ); +static HRESULT WINAPI DP_IF_SetPlayerName + ( IDirectPlay2Impl* This, DPID idPlayer, LPDPNAME lpPlayerName, + DWORD dwFlags, BOOL bAnsi ); +static HRESULT WINAPI DP_IF_AddGroupToGroup + ( IDirectPlay3Impl* This, DPID idParentGroup, DPID idGroup ); +static HRESULT WINAPI DP_IF_CreateGroup + ( IDirectPlay2AImpl* This, LPVOID lpMsgHdr, LPDPID lpidGroup, + LPDPNAME lpGroupName, LPVOID lpData, DWORD dwDataSize, + DWORD dwFlags, BOOL bAnsi ); +static HRESULT WINAPI DP_IF_CreateGroupInGroup + ( IDirectPlay3Impl* This, LPVOID lpMsgHdr, DPID idParentGroup, + LPDPID lpidGroup, LPDPNAME lpGroupName, LPVOID lpData, + DWORD dwDataSize, DWORD dwFlags, BOOL bAnsi ); +static HRESULT WINAPI DP_IF_AddPlayerToGroup + ( IDirectPlay2Impl* This, LPVOID lpMsgHdr, DPID idGroup, + DPID idPlayer, BOOL bAnsi ); +static HRESULT WINAPI DP_IF_DeleteGroupFromGroup + ( IDirectPlay3Impl* This, DPID idParentGroup, DPID idGroup ); +static HRESULT WINAPI DP_SetSessionDesc + ( IDirectPlay2Impl* This, LPCDPSESSIONDESC2 lpSessDesc, + DWORD dwFlags, BOOL bInitial, BOOL bAnsi ); +static HRESULT WINAPI DP_SecureOpen + ( IDirectPlay2Impl* This, LPCDPSESSIONDESC2 lpsd, DWORD dwFlags, + LPCDPSECURITYDESC lpSecurity, LPCDPCREDENTIALS lpCredentials, + BOOL bAnsi ); +static HRESULT WINAPI DP_SendEx + ( IDirectPlay2Impl* This, DPID idFrom, DPID idTo, DWORD dwFlags, + LPVOID lpData, DWORD dwDataSize, DWORD dwPriority, DWORD dwTimeout, + LPVOID lpContext, LPDWORD lpdwMsgID, BOOL bAnsi ); +static HRESULT WINAPI DP_IF_Receive + ( IDirectPlay2Impl* This, LPDPID lpidFrom, LPDPID lpidTo, + DWORD dwFlags, LPVOID lpData, LPDWORD lpdwDataSize, BOOL bAnsi ); +static HRESULT WINAPI DP_IF_GetMessageQueue + ( IDirectPlay4Impl* This, DPID idFrom, DPID idTo, DWORD dwFlags, + LPDWORD lpdwNumMsgs, LPDWORD lpdwNumBytes, BOOL bAnsi ); +static HRESULT WINAPI DP_SP_SendEx + ( IDirectPlay2Impl* This, DWORD dwFlags, + LPVOID lpData, DWORD dwDataSize, DWORD dwPriority, DWORD dwTimeout, + LPVOID lpContext, LPDWORD lpdwMsgID ); +static HRESULT WINAPI DP_IF_SetGroupData + ( IDirectPlay2Impl* This, DPID idGroup, LPVOID lpData, + DWORD dwDataSize, DWORD dwFlags, BOOL bAnsi ); +static HRESULT WINAPI DP_IF_GetPlayerCaps + ( IDirectPlay2Impl* This, DPID idPlayer, LPDPCAPS lpDPCaps, + DWORD dwFlags ); +static HRESULT WINAPI DP_IF_Close( IDirectPlay2Impl* This, BOOL bAnsi ); +static HRESULT WINAPI DP_IF_CancelMessage + ( IDirectPlay4Impl* This, DWORD dwMsgID, DWORD dwFlags, + DWORD dwMinPriority, DWORD dwMaxPriority, BOOL bAnsi ); +static HRESULT WINAPI DP_IF_EnumGroupsInGroup + ( IDirectPlay3AImpl* This, DPID idGroup, LPGUID lpguidInstance, + LPDPENUMPLAYERSCALLBACK2 lpEnumPlayersCallback2, + LPVOID lpContext, DWORD dwFlags, BOOL bAnsi ); +static HRESULT WINAPI DP_IF_GetGroupParent + ( IDirectPlay3AImpl* This, DPID idGroup, LPDPID lpidGroup, + BOOL bAnsi ); +static HRESULT WINAPI DP_IF_GetCaps + ( IDirectPlay2Impl* This, LPDPCAPS lpDPCaps, DWORD dwFlags ); +static HRESULT WINAPI DP_IF_EnumSessions + ( IDirectPlay2Impl* This, LPDPSESSIONDESC2 lpsd, DWORD dwTimeout, + LPDPENUMSESSIONSCALLBACK2 lpEnumSessionsCallback2, + LPVOID lpContext, DWORD dwFlags, BOOL bAnsi ); +static HRESULT WINAPI DP_IF_InitializeConnection + ( IDirectPlay3Impl* This, LPVOID lpConnection, DWORD dwFlags, BOOL bAnsi ); +static BOOL CALLBACK cbDPCreateEnumConnections( LPCGUID lpguidSP, + LPVOID lpConnection, DWORD dwConnectionSize, LPCDPNAME lpName, + DWORD dwFlags, LPVOID lpContext ); +static BOOL WINAPI DP_BuildSPCompoundAddr( LPGUID lpcSpGuid, LPVOID* lplpAddrBuf, + LPDWORD lpdwBufSize ); + + + +static inline DPID DP_NextObjectId(void); +static DPID DP_GetRemoteNextObjectId(void); + + +static void DP_CopySessionDesc( LPDPSESSIONDESC2 destSessionDesc, + LPCDPSESSIONDESC2 srcSessDesc, BOOL bAnsi ); + + +static HMODULE DP_LoadSP( LPCGUID lpcGuid, LPSPINITDATA lpSpData, LPBOOL lpbIsDpSp ); +static HRESULT DP_InitializeDPSP( IDirectPlay3Impl* This, HMODULE hServiceProvider ); +static HRESULT DP_InitializeDPLSP( IDirectPlay3Impl* This, HMODULE hServiceProvider ); + + + + + + +#define DPID_NOPARENT_GROUP 0 /* Magic number to indicate no parent of group */ +#define DPID_SYSTEM_GROUP DPID_NOPARENT_GROUP /* If system group is supported + we don't have to change much */ +#define DPID_NAME_SERVER 0x19a9d65b /* Don't ask me why */ + +/* Strip out dwFlag values which cannot be sent in the CREATEGROUP msg */ +#define DPMSG_CREATEGROUP_DWFLAGS(x) ( (x) & DPGROUP_HIDDEN ) + +/* Strip out all dwFlags values for CREATEPLAYER msg */ +#define DPMSG_CREATEPLAYER_DWFLAGS(x) 0 + +static LONG kludgePlayerGroupId = 1000; + +/* ------------------------------------------------------------------ */ + + +static BOOL DP_CreateIUnknown( LPVOID lpDP ) +{ + IDirectPlay2AImpl *This = (IDirectPlay2AImpl *)lpDP; + + This->unk = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->unk) ) ); + if ( This->unk == NULL ) + { + return FALSE; + } + + InitializeCriticalSection( &This->unk->DP_lock ); + + return TRUE; +} + +static BOOL DP_DestroyIUnknown( LPVOID lpDP ) +{ + IDirectPlay2AImpl *This = (IDirectPlay2AImpl *)lpDP; + + DeleteCriticalSection( &This->unk->DP_lock ); + HeapFree( GetProcessHeap(), 0, This->unk ); + + return TRUE; +} + +static BOOL DP_CreateDirectPlay2( LPVOID lpDP ) +{ + IDirectPlay2AImpl *This = (IDirectPlay2AImpl *)lpDP; + + This->dp2 = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->dp2) ) ); + if ( This->dp2 == NULL ) + { + return FALSE; + } + + This->dp2->bConnectionOpen = FALSE; + + This->dp2->hEnumSessionThread = INVALID_HANDLE_VALUE; + + This->dp2->bHostInterface = FALSE; + + DPQ_INIT(This->dp2->receiveMsgs); + DPQ_INIT(This->dp2->sendMsgs); + DPQ_INIT(This->dp2->replysExpected); + + if( !NS_InitializeSessionCache( &This->dp2->lpNameServerData ) ) + { + /* FIXME: Memory leak */ + return FALSE; + } + + /* Provide an initial session desc with nothing in it */ + This->dp2->lpSessionDesc = HeapAlloc( GetProcessHeap(), + HEAP_ZERO_MEMORY, + sizeof( *This->dp2->lpSessionDesc ) ); + if( This->dp2->lpSessionDesc == NULL ) + { + /* FIXME: Memory leak */ + return FALSE; + } + This->dp2->lpSessionDesc->dwSize = sizeof( *This->dp2->lpSessionDesc ); + + /* We are emulating a dp 6 implementation */ + This->dp2->spData.dwSPVersion = DPSP_MAJORVERSION; + + This->dp2->spData.lpCB = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, + sizeof( *This->dp2->spData.lpCB ) ); + This->dp2->spData.lpCB->dwSize = sizeof( *This->dp2->spData.lpCB ); + This->dp2->spData.lpCB->dwVersion = DPSP_MAJORVERSION; + + /* This is the pointer to the service provider */ + if( FAILED( DPSP_CreateInterface( &IID_IDirectPlaySP, + (LPVOID*)&This->dp2->spData.lpISP, This ) ) + ) + { + /* FIXME: Memory leak */ + return FALSE; + } + + /* Setup lobby provider information */ + This->dp2->dplspData.dwSPVersion = DPSP_MAJORVERSION; + This->dp2->dplspData.lpCB = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, + sizeof( *This->dp2->dplspData.lpCB ) ); + This->dp2->dplspData.lpCB->dwSize = sizeof( *This->dp2->dplspData.lpCB ); + + if( FAILED( DPLSP_CreateInterface( &IID_IDPLobbySP, + (LPVOID*)&This->dp2->dplspData.lpISP, This ) ) + ) + { + /* FIXME: Memory leak */ + return FALSE; + } + + return TRUE; +} + +/* Definition of the global function in dplayx_queue.h. # + * FIXME: Would it be better to have a dplayx_queue.c for this function? */ +DPQ_DECL_DELETECB( cbDeleteElemFromHeap, LPVOID ) +{ + HeapFree( GetProcessHeap(), 0, elem ); +} + +/* Function to delete the list of groups with this interface. Needs to + * delete the group and player lists associated with this group as well + * as the group data associated with this group. It should not delete + * player data as that is shared with the top player list and will be + * deleted with that. + */ +DPQ_DECL_DELETECB( cbDeleteGroupsElem, lpGroupList ); +DPQ_DECL_DELETECB( cbDeleteGroupsElem, lpGroupList ) +{ + DPQ_DELETEQ( elem->lpGData->groups, groups, + lpGroupList, cbDeleteElemFromHeap ); + DPQ_DELETEQ( elem->lpGData->players, players, + lpPlayerList, cbDeleteElemFromHeap ); + HeapFree( GetProcessHeap(), 0, elem->lpGData ); + HeapFree( GetProcessHeap(), 0, elem ); +} + +/* Function to delete the list of players with this interface. Needs to + * delete the player data for all players as well. + */ +DPQ_DECL_DELETECB( cbDeletePlayerElem, lpPlayerList ); +DPQ_DECL_DELETECB( cbDeletePlayerElem, lpPlayerList ) +{ + HeapFree( GetProcessHeap(), 0, elem->lpPData ); + HeapFree( GetProcessHeap(), 0, elem ); +} + +static BOOL DP_DestroyDirectPlay2( LPVOID lpDP ) +{ + IDirectPlay2AImpl *This = (IDirectPlay2AImpl *)lpDP; + + if( This->dp2->hEnumSessionThread != INVALID_HANDLE_VALUE ) + { + TerminateThread( This->dp2->hEnumSessionThread, 0 ); + CloseHandle( This->dp2->hEnumSessionThread ); + } + + /* Finish with the SP - have it shutdown */ + if( This->dp2->spData.lpCB->ShutdownEx ) + { + DPSP_SHUTDOWNDATA data; + + TRACE( "Calling SP ShutdownEx\n" ); + + data.lpISP = This->dp2->spData.lpISP; + + (*This->dp2->spData.lpCB->ShutdownEx)( &data ); + } + else if (This->dp2->spData.lpCB->Shutdown ) /* obsolete interface */ + { + TRACE( "Calling obsolete SP Shutdown\n" ); + (*This->dp2->spData.lpCB->Shutdown)(); + } + + /* Unload the SP (if it exists) */ + if( This->dp2->hServiceProvider != 0 ) + { + FreeLibrary( This->dp2->hServiceProvider ); + } + + /* Unload the Lobby Provider (if it exists) */ + if( This->dp2->hDPLobbyProvider != 0 ) + { + FreeLibrary( This->dp2->hDPLobbyProvider ); + } + +#if 0 + DPQ_DELETEQ( This->dp2->players, players, lpPlayerList, cbDeletePlayerElem ); + DPQ_DELETEQ( This->dp2->groups, groups, lpGroupList, cbDeleteGroupsElem ); +#endif + + /* FIXME: Need to delete receive and send msgs queue contents */ + + NS_DeleteSessionCache( This->dp2->lpNameServerData ); + + HeapFree( GetProcessHeap(), 0, This->dp2->lpSessionDesc ); + + IDirectPlaySP_Release( This->dp2->spData.lpISP ); + + /* Delete the contents */ + HeapFree( GetProcessHeap(), 0, This->dp2 ); + + return TRUE; +} + +static BOOL DP_CreateDirectPlay3( LPVOID lpDP ) +{ + IDirectPlay3AImpl *This = (IDirectPlay3AImpl *)lpDP; + + This->dp3 = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->dp3) ) ); + if ( This->dp3 == NULL ) + { + return FALSE; + } + + return TRUE; +} + +static BOOL DP_DestroyDirectPlay3( LPVOID lpDP ) +{ + IDirectPlay3AImpl *This = (IDirectPlay3AImpl *)lpDP; + + /* Delete the contents */ + HeapFree( GetProcessHeap(), 0, This->dp3 ); + + return TRUE; +} + +static BOOL DP_CreateDirectPlay4( LPVOID lpDP ) +{ + IDirectPlay4AImpl *This = (IDirectPlay4AImpl *)lpDP; + + This->dp4 = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->dp4) ) ); + if ( This->dp4 == NULL ) + { + return FALSE; + } + + return TRUE; +} + +static BOOL DP_DestroyDirectPlay4( LPVOID lpDP ) +{ + IDirectPlay3AImpl *This = (IDirectPlay3AImpl *)lpDP; + + /* Delete the contents */ + HeapFree( GetProcessHeap(), 0, This->dp4 ); + + return TRUE; +} + + +/* Create a new interface */ +extern +HRESULT DP_CreateInterface + ( REFIID riid, LPVOID* ppvObj ) +{ + TRACE( " for %s\n", debugstr_guid( riid ) ); + + *ppvObj = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, + sizeof( IDirectPlay2Impl ) ); + + if( *ppvObj == NULL ) + { + return DPERR_OUTOFMEMORY; + } + + if( IsEqualGUID( &IID_IDirectPlay2, riid ) ) + { + IDirectPlay2Impl *This = (IDirectPlay2Impl *)*ppvObj; + This->lpVtbl = &directPlay2WVT; + } + else if( IsEqualGUID( &IID_IDirectPlay2A, riid ) ) + { + IDirectPlay2AImpl *This = (IDirectPlay2AImpl *)*ppvObj; + This->lpVtbl = &directPlay2AVT; + } + else if( IsEqualGUID( &IID_IDirectPlay3, riid ) ) + { + IDirectPlay3Impl *This = (IDirectPlay3Impl *)*ppvObj; + This->lpVtbl = &directPlay3WVT; + } + else if( IsEqualGUID( &IID_IDirectPlay3A, riid ) ) + { + IDirectPlay3AImpl *This = (IDirectPlay3AImpl *)*ppvObj; + This->lpVtbl = &directPlay3AVT; + } + else if( IsEqualGUID( &IID_IDirectPlay4, riid ) ) + { + IDirectPlay4Impl *This = (IDirectPlay4Impl *)*ppvObj; + This->lpVtbl = &directPlay4WVT; + } + else if( IsEqualGUID( &IID_IDirectPlay4A, riid ) ) + { + IDirectPlay4AImpl *This = (IDirectPlay4AImpl *)*ppvObj; + This->lpVtbl = &directPlay4AVT; + } + else + { + /* Unsupported interface */ + HeapFree( GetProcessHeap(), 0, *ppvObj ); + *ppvObj = NULL; + + return E_NOINTERFACE; + } + + /* Initialize it */ + if ( DP_CreateIUnknown( *ppvObj ) && + DP_CreateDirectPlay2( *ppvObj ) && + DP_CreateDirectPlay3( *ppvObj ) && + DP_CreateDirectPlay4( *ppvObj ) + ) + { + IDirectPlayX_AddRef( (LPDIRECTPLAY2A)*ppvObj ); + + return S_OK; + } + + /* Initialize failed, destroy it */ + DP_DestroyDirectPlay4( *ppvObj ); + DP_DestroyDirectPlay3( *ppvObj ); + DP_DestroyDirectPlay2( *ppvObj ); + DP_DestroyIUnknown( *ppvObj ); + + HeapFree( GetProcessHeap(), 0, *ppvObj ); + + *ppvObj = NULL; + return DPERR_NOMEMORY; +} + + +/* Direct Play methods */ + +/* Shared between all dplay types */ +static HRESULT WINAPI DP_QueryInterface + ( LPDIRECTPLAY2 iface, REFIID riid, LPVOID* ppvObj ) +{ + IDirectPlay2Impl *This = (IDirectPlay2Impl *)iface; + TRACE("(%p)->(%s,%p)\n", This, debugstr_guid( riid ), ppvObj ); + + *ppvObj = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, + sizeof( *This ) ); + + if( *ppvObj == NULL ) + { + return DPERR_OUTOFMEMORY; + } + + CopyMemory( *ppvObj, This, sizeof( *This ) ); + (*(IDirectPlay2Impl**)ppvObj)->ulInterfaceRef = 0; + + if( IsEqualGUID( &IID_IDirectPlay2, riid ) ) + { + IDirectPlay2Impl *This = (IDirectPlay2Impl *)*ppvObj; + This->lpVtbl = &directPlay2WVT; + } + else if( IsEqualGUID( &IID_IDirectPlay2A, riid ) ) + { + IDirectPlay2AImpl *This = (IDirectPlay2AImpl *)*ppvObj; + This->lpVtbl = &directPlay2AVT; + } + else if( IsEqualGUID( &IID_IDirectPlay3, riid ) ) + { + IDirectPlay3Impl *This = (IDirectPlay3Impl *)*ppvObj; + This->lpVtbl = &directPlay3WVT; + } + else if( IsEqualGUID( &IID_IDirectPlay3A, riid ) ) + { + IDirectPlay3AImpl *This = (IDirectPlay3AImpl *)*ppvObj; + This->lpVtbl = &directPlay3AVT; + } + else if( IsEqualGUID( &IID_IDirectPlay4, riid ) ) + { + IDirectPlay4Impl *This = (IDirectPlay4Impl *)*ppvObj; + This->lpVtbl = &directPlay4WVT; + } + else if( IsEqualGUID( &IID_IDirectPlay4A, riid ) ) + { + IDirectPlay4AImpl *This = (IDirectPlay4AImpl *)*ppvObj; + This->lpVtbl = &directPlay4AVT; + } + else + { + /* Unsupported interface */ + HeapFree( GetProcessHeap(), 0, *ppvObj ); + *ppvObj = NULL; + + return E_NOINTERFACE; + } + + IDirectPlayX_AddRef( (LPDIRECTPLAY2)*ppvObj ); + + return S_OK; +} + +/* Shared between all dplay types */ +static ULONG WINAPI DP_AddRef + ( LPDIRECTPLAY3 iface ) +{ + ULONG ulInterfaceRefCount, ulObjRefCount; + IDirectPlay3Impl *This = (IDirectPlay3Impl *)iface; + + ulObjRefCount = InterlockedIncrement( &This->unk->ulObjRef ); + ulInterfaceRefCount = InterlockedIncrement( &This->ulInterfaceRef ); + + TRACE( "ref count incremented to %lu:%lu for %p\n", + ulInterfaceRefCount, ulObjRefCount, This ); + + return ulObjRefCount; +} + +static ULONG WINAPI DP_Release +( LPDIRECTPLAY3 iface ) +{ + ULONG ulInterfaceRefCount, ulObjRefCount; + + IDirectPlay3Impl *This = (IDirectPlay3Impl *)iface; + + ulObjRefCount = InterlockedDecrement( &This->unk->ulObjRef ); + ulInterfaceRefCount = InterlockedDecrement( &This->ulInterfaceRef ); + + TRACE( "ref count decremented to %lu:%lu for %p\n", + ulInterfaceRefCount, ulObjRefCount, This ); + + /* Deallocate if this is the last reference to the object */ + if( ulObjRefCount == 0 ) + { + /* If we're destroying the object, this must be the last ref + of the last interface */ + DP_DestroyDirectPlay4( This ); + DP_DestroyDirectPlay3( This ); + DP_DestroyDirectPlay2( This ); + DP_DestroyIUnknown( This ); + } + + /* Deallocate the interface */ + if( ulInterfaceRefCount == 0 ) + { + HeapFree( GetProcessHeap(), 0, This ); + } + + return ulObjRefCount; +} + +static inline DPID DP_NextObjectId(void) +{ + return (DPID)InterlockedIncrement( &kludgePlayerGroupId ); +} + +/* *lplpReply will be non NULL iff there is something to reply */ +HRESULT DP_HandleMessage( IDirectPlay2Impl* This, LPCVOID lpcMessageBody, + DWORD dwMessageBodySize, LPCVOID lpcMessageHeader, + WORD wCommandId, WORD wVersion, + LPVOID* lplpReply, LPDWORD lpdwMsgSize ) +{ + TRACE( "(%p)->(%p,0x%08lx,%p,%u,%u)\n", + This, lpcMessageBody, dwMessageBodySize, lpcMessageHeader, wCommandId, + wVersion ); + + switch( wCommandId ) + { + /* Name server needs to handle this request */ + case DPMSGCMD_ENUMSESSIONSREQUEST: + { + /* Reply expected */ + NS_ReplyToEnumSessionsRequest( lpcMessageBody, lplpReply, lpdwMsgSize, This ); + + break; + } + + /* Name server needs to handle this request */ + case DPMSGCMD_ENUMSESSIONSREPLY: + { + /* No reply expected */ + NS_AddRemoteComputerAsNameServer( lpcMessageHeader, + This->dp2->spData.dwSPHeaderSize, + (LPDPMSG_ENUMSESSIONSREPLY)lpcMessageBody, + This->dp2->lpNameServerData ); + break; + } + + case DPMSGCMD_REQUESTNEWPLAYERID: + { + LPCDPMSG_REQUESTNEWPLAYERID lpcMsg = + (LPCDPMSG_REQUESTNEWPLAYERID)lpcMessageBody; + + LPDPMSG_NEWPLAYERIDREPLY lpReply; + + *lpdwMsgSize = This->dp2->spData.dwSPHeaderSize + sizeof( *lpReply ); + + *lplpReply = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, *lpdwMsgSize ); + + FIXME( "Ignoring dwFlags 0x%08lx in request msg\n", + lpcMsg->dwFlags ); + + /* Setup the reply */ + lpReply = (LPDPMSG_NEWPLAYERIDREPLY)( (BYTE*)(*lplpReply) + + This->dp2->spData.dwSPHeaderSize ); + + lpReply->envelope.dwMagic = DPMSGMAGIC_DPLAYMSG; + lpReply->envelope.wCommandId = DPMSGCMD_NEWPLAYERIDREPLY; + lpReply->envelope.wVersion = DPMSGVER_DP6; + [truncated at 1000 lines; 12987 more skipped]
19 years, 1 month
1
0
0
0
[gedmurphy] 18810: put it in a flyers folder
by gedmurphy@svn.reactos.com
put it in a flyers folder Deleted: trunk/press-media/ReactOS.doc Added: trunk/press-media/flyers/ _____ Deleted: trunk/press-media/ReactOS.doc (Binary files differ)
19 years, 1 month
1
0
0
0
← Newer
1
...
8
9
10
11
12
13
14
...
74
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
Results per page:
10
25
50
100
200