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
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
August 2008
----- 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
27 participants
853 discussions
Start a n
N
ew thread
[gedmurphy] 35273: Missed this on cleanup. Hail ros-diffs.
by gedmurphy@svn.reactos.org
Author: gedmurphy Date: Mon Aug 11 06:09:05 2008 New Revision: 35273 URL:
http://svn.reactos.org/svn/reactos?rev=35273&view=rev
Log: Missed this on cleanup. Hail ros-diffs. Modified: trunk/tools/reactosdbg/Pipe/namedpipe.cs Modified: trunk/tools/reactosdbg/Pipe/namedpipe.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/Pipe/namedpipe.cs…
============================================================================== --- trunk/tools/reactosdbg/Pipe/namedpipe.cs [iso-8859-1] (original) +++ trunk/tools/reactosdbg/Pipe/namedpipe.cs [iso-8859-1] Mon Aug 11 06:09:05 2008 @@ -94,7 +94,7 @@ private const string pipeName = @"\\.\Pipe\RosDbg"; private const Int32 INVALID_HANDLE_VALUE = -1; - IntPtr handle; + private IntPtr handle; //FileAccess mode; protected NamedPipe() @@ -109,8 +109,6 @@ public IntPtr Create(string name) { - IntPtr handle; - handle = Kernel32.CreateNamedPipe(name, OpenMode.PIPE_ACCESS_DUPLEX | OpenMode.FILE_FLAG_OVERLAPPED, 0,
16 years, 2 months
1
0
0
0
[gedmurphy] 35272: - Start of an implementation of a named pipe wrapper needed for hooking RosDbg up to vmware. - Due to p/invoke, this is a Win32 only implementation. Linux users will need to use mono with Wine.
by gedmurphy@svn.reactos.org
Author: gedmurphy Date: Mon Aug 11 06:04:23 2008 New Revision: 35272 URL:
http://svn.reactos.org/svn/reactos?rev=35272&view=rev
Log: - Start of an implementation of a named pipe wrapper needed for hooking RosDbg up to vmware. - Due to p/invoke, this is a Win32 only implementation. Linux users will need to use mono with Wine. Added: trunk/tools/reactosdbg/Pipe/namedpipe.cs Modified: trunk/tools/reactosdbg/Pipe/Pipe.csproj trunk/tools/reactosdbg/RosDBG/MainWindow.Designer.cs trunk/tools/reactosdbg/RosDBG/MainWindow.cs trunk/tools/reactosdbg/RosDBG/RosDBG.csproj Modified: trunk/tools/reactosdbg/Pipe/Pipe.csproj URL:
http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/Pipe/Pipe.csproj?…
============================================================================== --- trunk/tools/reactosdbg/Pipe/Pipe.csproj [iso-8859-1] (original) +++ trunk/tools/reactosdbg/Pipe/Pipe.csproj [iso-8859-1] Mon Aug 11 06:04:23 2008 @@ -45,6 +45,7 @@ <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> + <Compile Include="namedpipe.cs" /> <Compile Include="serialpipe.cs" /> <Compile Include="pipe.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> Added: trunk/tools/reactosdbg/Pipe/namedpipe.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/Pipe/namedpipe.cs…
============================================================================== --- trunk/tools/reactosdbg/Pipe/namedpipe.cs (added) +++ trunk/tools/reactosdbg/Pipe/namedpipe.cs [iso-8859-1] Mon Aug 11 06:04:23 2008 @@ -1,0 +1,221 @@ +using System; +using System.IO; +using System.ComponentModel; +using System.Runtime.InteropServices; + + +namespace AbstractPipe +{ + class Kernel32 + { + [DllImport("kernel32.dll", SetLastError = true)] + public static extern IntPtr CreateNamedPipe( + String lpName, + OpenMode dwOpenMode, + uint dwPipeMode, + uint nMaxInstances, + uint nOutBufferSize, + uint nInBufferSize, + DefaultTimeout nDefaultTimeOut, + IntPtr pipeSecurityDescriptor + ); + + [DllImport("kernel32.dll", SetLastError = true)] + public static extern bool ConnectNamedPipe( + IntPtr hHandle, + Overlapped lpOverlapped + ); + + [DllImport("kernel32.dll", SetLastError = true)] + public static extern bool ReadFile( + IntPtr hHandle, + byte[] lpBuffer, + uint nNumberOfBytesToRead, + ref uint lpNumberOfBytesRead, + IntPtr lpOverlapped + ); + + [DllImport("kernel32.dll", SetLastError = true)] + public static extern bool WriteFile( + IntPtr hHandle, + byte[] lpBuffer, + uint nNumberOfBytesToWrite, + ref uint lpNumberOfBytesWritten, + IntPtr lpOverlapped + ); + + [DllImport("kernel32.dll", SetLastError = true)] + public static extern bool CloseHandle( + IntPtr hHandle); + + [DllImport("kernel32.dll", SetLastError = true)] + public static extern uint GetLastError(); + + [DllImport("kernel32.dll", SetLastError = true)] + public static extern bool DisconnectNamedPipe( + IntPtr hHandle); + + [DllImport("kernel32.dll", SetLastError = true)] + public static extern bool FlushFileBuffers(IntPtr handle); + } + + [StructLayout(LayoutKind.Sequential)] + public class Overlapped + { + } + + public enum OpenMode : uint + { + PIPE_ACCESS_INBOUND = 0x00000001, + PIPE_ACCESS_OUTBOUND = 0x00000002, + PIPE_ACCESS_DUPLEX = 0x00000003, + FILE_FLAG_FIRST_PIPE_INSTANCE = 0x00080000, + FILE_FLAG_OVERLAPPED = 0x40000000, + FILE_FLAG_WRITE_THROUGH = 0x80000000 + } + + public enum DefaultTimeout : uint + { + NMPWAIT_USE_DEFAULT_WAIT = 0x00000000, + NMPWAIT_NOWAIT = 0x00000001, + NMPWAIT_WAIT_FOREVER = 0xffffffff + } + + [StructLayout(LayoutKind.Sequential)] + public struct SECURITY_ATTRIBUTES + { + public int nLength; + public IntPtr lpSecurityDescriptor; + public int bInheritHandle; + } + + public class NamedPipe// : Pipe + { + private const string pipeName = @"\\.\Pipe\RosDbg"; + private const Int32 INVALID_HANDLE_VALUE = -1; + + IntPtr handle; + //FileAccess mode; + + protected NamedPipe() + { + handle = IntPtr.Zero; + } + + public IntPtr Create() + { + return Create(pipeName); + } + + public IntPtr Create(string name) + { + IntPtr handle; + + handle = Kernel32.CreateNamedPipe(name, + OpenMode.PIPE_ACCESS_DUPLEX | OpenMode.FILE_FLAG_OVERLAPPED, + 0, + 1, + 100, + 100, + DefaultTimeout.NMPWAIT_WAIT_FOREVER, + IntPtr.Zero); + if (handle.ToInt32() == INVALID_HANDLE_VALUE) + { + throw new Win32Exception("Error creating named pipe " + name + " . Internal error: " + Marshal.GetLastWin32Error().ToString()); + } + + return handle; + } + + public void Disconnect() + { + Kernel32.DisconnectNamedPipe(handle); + } + + public void Close() + { + Kernel32.CloseHandle(handle); + handle = IntPtr.Zero; + } + + public void Flush() + { + if (handle == IntPtr.Zero) + throw new ObjectDisposedException("NamedPipeStream", "The stream has already been closed"); + Kernel32.FlushFileBuffers(handle); + } + + public int Read(byte[] buffer, int offset, int count) + { + if (buffer == null) + throw new ArgumentNullException("buffer", "The buffer to read into cannot be null"); + if (buffer.Length < (offset + count)) + throw new ArgumentException("Buffer is not large enough to hold requested data", "buffer"); + if (offset < 0) + throw new ArgumentOutOfRangeException("offset", offset, "Offset cannot be negative"); + if (count < 0) + throw new ArgumentOutOfRangeException("count", count, "Count cannot be negative"); + if (handle == IntPtr.Zero) + throw new ObjectDisposedException("NamedPipeStream", "The stream has already been closed"); + + // first read the data into an internal buffer since ReadFile cannot read into a buf at + // a specified offset + uint read = 0; + + byte[] buf = buffer; + if (offset != 0) + { + buf = new byte[count]; + } + bool f = Kernel32.ReadFile(handle, buf, (uint)count, ref read, IntPtr.Zero); + if (!f) + { + throw new Win32Exception(Marshal.GetLastWin32Error(), "ReadFile failed"); + } + if (offset != 0) + { + for (int x = 0; x < read; x++) + { + buffer[offset + x] = buf[x]; + } + + } + return (int)read; + } + + public void Write(byte[] buffer, int offset, int count) + { + if (buffer == null) + throw new ArgumentNullException("buffer", "The buffer to write into cannot be null"); + if (buffer.Length < (offset + count)) + throw new ArgumentException("Buffer does not contain amount of requested data", "buffer"); + if (offset < 0) + throw new ArgumentOutOfRangeException("offset", offset, "Offset cannot be negative"); + if (count < 0) + throw new ArgumentOutOfRangeException("count", count, "Count cannot be negative"); + if (handle == IntPtr.Zero) + throw new ObjectDisposedException("NamedPipeStream", "The stream has already been closed"); + + // copy data to internal buffer to allow writing from a specified offset + if (offset != 0) + { + byte[] buf = new Byte[count]; + for (int x = 0; x < count; x++) + { + buf[x] = buffer[offset + x]; + } + buffer = buf; + } + uint written = 0; + bool result = Kernel32.WriteFile(handle, buffer, (uint)count, ref written, IntPtr.Zero); + + if (!result) + { + int err = (int)Marshal.GetLastWin32Error(); + throw new Win32Exception(err, "Writing to the stream failed"); + } + if (written < count) + throw new IOException("Unable to write entire buffer to stream"); + } + } +} Modified: trunk/tools/reactosdbg/RosDBG/MainWindow.Designer.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/MainWindow…
============================================================================== --- trunk/tools/reactosdbg/RosDBG/MainWindow.Designer.cs [iso-8859-1] (original) +++ trunk/tools/reactosdbg/RosDBG/MainWindow.Designer.cs [iso-8859-1] Mon Aug 11 06:04:23 2008 @@ -57,15 +57,15 @@ this.NewWindowItem = new System.Windows.Forms.ToolStripMenuItem(); this.detachCurrentTabToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.closeCurrentTabToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem(); + this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.infoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.WorkTabs = new System.Windows.Forms.TabControl(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.RunStatus = new System.Windows.Forms.ToolStripStatusLabel(); this.contextMenuTabStrip = new System.Windows.Forms.ContextMenuStrip(this.components); this.closeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem(); - this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.infoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); @@ -148,10 +148,10 @@ // // connectPipeToolStripMenuItem // - this.connectPipeToolStripMenuItem.Enabled = false; this.connectPipeToolStripMenuItem.Name = "connectPipeToolStripMenuItem"; this.connectPipeToolStripMenuItem.Size = new System.Drawing.Size(175, 22); this.connectPipeToolStripMenuItem.Text = "Connect Pipe ..."; + this.connectPipeToolStripMenuItem.Click += new System.EventHandler(this.connectPipeToolStripMenuItem_Click); // // connectTCPIPToolStripMenuItem // @@ -308,6 +308,28 @@ this.closeCurrentTabToolStripMenuItem.Text = "Close Current Tab"; this.closeCurrentTabToolStripMenuItem.Click += new System.EventHandler(this.closeCurrentTabToolStripMenuItem_Click); // + // toolStripMenuItem2 + // + this.toolStripMenuItem2.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.helpToolStripMenuItem, + this.infoToolStripMenuItem}); + this.toolStripMenuItem2.Name = "toolStripMenuItem2"; + this.toolStripMenuItem2.Size = new System.Drawing.Size(24, 20); + this.toolStripMenuItem2.Text = "&?"; + // + // helpToolStripMenuItem + // + this.helpToolStripMenuItem.Name = "helpToolStripMenuItem"; + this.helpToolStripMenuItem.Size = new System.Drawing.Size(107, 22); + this.helpToolStripMenuItem.Text = "&Help"; + this.helpToolStripMenuItem.Click += new System.EventHandler(this.helpToolStripMenuItem_Click); + // + // infoToolStripMenuItem + // + this.infoToolStripMenuItem.Name = "infoToolStripMenuItem"; + this.infoToolStripMenuItem.Size = new System.Drawing.Size(107, 22); + this.infoToolStripMenuItem.Text = "&About"; + // // splitContainer2 // this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; @@ -366,28 +388,6 @@ this.closeToolStripMenuItem.Size = new System.Drawing.Size(103, 22); this.closeToolStripMenuItem.Text = "&Close"; this.closeToolStripMenuItem.Click += new System.EventHandler(this.closeToolStripMenuItem_Click); - // - // toolStripMenuItem2 - // - this.toolStripMenuItem2.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.helpToolStripMenuItem, - this.infoToolStripMenuItem}); - this.toolStripMenuItem2.Name = "toolStripMenuItem2"; - this.toolStripMenuItem2.Size = new System.Drawing.Size(24, 20); - this.toolStripMenuItem2.Text = "&?"; - // - // helpToolStripMenuItem - // - this.helpToolStripMenuItem.Name = "helpToolStripMenuItem"; - this.helpToolStripMenuItem.Size = new System.Drawing.Size(152, 22); - this.helpToolStripMenuItem.Text = "&Help"; - this.helpToolStripMenuItem.Click += new System.EventHandler(this.helpToolStripMenuItem_Click); - // - // infoToolStripMenuItem - // - this.infoToolStripMenuItem.Name = "infoToolStripMenuItem"; - this.infoToolStripMenuItem.Size = new System.Drawing.Size(152, 22); - this.infoToolStripMenuItem.Text = "&About"; // // MainWindow // Modified: trunk/tools/reactosdbg/RosDBG/MainWindow.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/MainWindow…
============================================================================== --- trunk/tools/reactosdbg/RosDBG/MainWindow.cs [iso-8859-1] (original) +++ trunk/tools/reactosdbg/RosDBG/MainWindow.cs [iso-8859-1] Mon Aug 11 06:04:23 2008 @@ -321,7 +321,15 @@ AddTab(Help); WorkTabs.SelectTab(WorkTabs.TabCount - 1); } - + + private void connectPipeToolStripMenuItem_Click(object sender, EventArgs e) + { + PipeTargetSelect targetSelect = new PipeTargetSelect(); + if (targetSelect.ShowDialog() == DialogResult.OK) + { + + } + } } public class InteractiveInputEventArgs : EventArgs Modified: trunk/tools/reactosdbg/RosDBG/RosDBG.csproj URL:
http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/RosDBG.csp…
============================================================================== --- trunk/tools/reactosdbg/RosDBG/RosDBG.csproj [iso-8859-1] (original) +++ trunk/tools/reactosdbg/RosDBG/RosDBG.csproj [iso-8859-1] Mon Aug 11 06:04:23 2008 @@ -115,6 +115,12 @@ <Compile Include="Modules.Designer.cs"> <DependentUpon>Modules.cs</DependentUpon> </Compile> + <Compile Include="PipeTargetSelect.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="PipeTargetSelect.Designer.cs"> + <DependentUpon>PipeTargetSelect.cs</DependentUpon> + </Compile> <Compile Include="Program.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <EmbeddedResource Include="BackTrace.resx"> @@ -143,6 +149,10 @@ </EmbeddedResource> <EmbeddedResource Include="Modules.resx"> <DependentUpon>Modules.cs</DependentUpon> + <SubType>Designer</SubType> + </EmbeddedResource> + <EmbeddedResource Include="PipeTargetSelect.resx"> + <DependentUpon>PipeTargetSelect.cs</DependentUpon> <SubType>Designer</SubType> </EmbeddedResource> <EmbeddedResource Include="Properties\Resources.resx"> @@ -282,4 +292,4 @@ <PropertyGroup> <PostBuildEvent>copy $(SolutionDir)dbghelptest\dbghelp.dll $(TargetDir)</PostBuildEvent> </PropertyGroup> -</Project> +</Project>
16 years, 2 months
1
0
0
0
[pschweitzer] 35271: In DDK, NOTIFY_SYNC is only a pointer
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Mon Aug 11 05:06:40 2008 New Revision: 35271 URL:
http://svn.reactos.org/svn/reactos?rev=35271&view=rev
Log: In DDK, NOTIFY_SYNC is only a pointer Modified: branches/pierre-fsd/include/ddk/ntifs.h Modified: branches/pierre-fsd/include/ddk/ntifs.h URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/include/ddk/ntifs.h?…
============================================================================== --- branches/pierre-fsd/include/ddk/ntifs.h [iso-8859-1] (original) +++ branches/pierre-fsd/include/ddk/ntifs.h [iso-8859-1] Mon Aug 11 05:06:40 2008 @@ -576,20 +576,7 @@ typedef ULONG VBN; typedef VBN *PVBN; -typedef struct _NOTIFY_SYNC -{ - ULONG Unknown0; - ULONG Unknown1; - ULONG Unknown2; - USHORT Unknown3; - USHORT Unknown4; - ULONG Unknown5; - ULONG Unknown6; - ULONG Unknown7; - ULONG Unknown8; - ULONG Unknown9; - ULONG Unknown10; -} NOTIFY_SYNC, * PNOTIFY_SYNC; +typedef PVOID PNOTIFY_SYNC; typedef enum _FAST_IO_POSSIBLE { FastIoIsNotPossible,
16 years, 2 months
1
0
0
0
[janderwald] 35270: * implement restoring of a deleted file * use volume labels for storing bitbucket information * store a context for each drive * apply changes for each available drive
by janderwald@svn.reactos.org
Author: janderwald Date: Mon Aug 11 04:51:35 2008 New Revision: 35270 URL:
http://svn.reactos.org/svn/reactos?rev=35270&view=rev
Log: * implement restoring of a deleted file * use volume labels for storing bitbucket information * store a context for each drive * apply changes for each available drive Modified: trunk/reactos/dll/win32/shell32/recyclebin.c Modified: trunk/reactos/dll/win32/shell32/recyclebin.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/recycleb…
============================================================================== --- trunk/reactos/dll/win32/shell32/recyclebin.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/recyclebin.c [iso-8859-1] Mon Aug 11 04:51:35 2008 @@ -77,26 +77,6 @@ #define COLUMNS_COUNT 6 -static HRESULT FormatDateTime(LPWSTR buffer, int size, FILETIME * ft) -{ - FILETIME lft; - SYSTEMTIME time; - int ret; - - FileTimeToLocalFileTime(ft, &lft); - FileTimeToSystemTime(&lft, &time); - - ret = GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &time, NULL, buffer, size); - if (ret>0 && ret<size) - { - /* Append space + time without seconds */ - buffer[ret-1] = ' '; - GetTimeFormatW(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &time, NULL, &buffer[ret], size - ret); - } - - return (ret!=0 ? E_FAIL : S_OK); -} - /* * Recycle Bin folder */ @@ -116,6 +96,21 @@ LPITEMIDLIST pidl; LPCITEMIDLIST apidl; } RecycleBin; + +typedef struct +{ + PIDLRecycleStruct *pFileDetails; + HANDLE hDeletedFile; + BOOL bFound; +}SEARCH_CONTEXT, *PSEARCH_CONTEXT; + +typedef struct +{ + DWORD dwNukeOnDelete; + DWORD dwSerial; + DWORD dwMaxCapacity; +}DRIVE_ITEM_CONTEXT, *PDRIVE_ITEM_CONTEXT; + static const IContextMenu2Vtbl recycleBincmVtblFolder; static const IContextMenu2Vtbl recycleBincmVtblBitbucketItem; @@ -276,6 +271,57 @@ return NULL; } +BOOL +WINAPI +CBSearchBitBucket(IN PVOID Context, IN HANDLE hDeletedFile) +{ + PSEARCH_CONTEXT pContext = (PSEARCH_CONTEXT)Context; + + PDELETED_FILE_DETAILS_W pFileDetails; + DWORD dwSize; + BOOL ret; + + if (!GetDeletedFileDetailsW(hDeletedFile, + 0, + NULL, + &dwSize) && + GetLastError() != ERROR_INSUFFICIENT_BUFFER) + { + ERR("GetDeletedFileDetailsW failed\n"); + return FALSE; + } + + pFileDetails = SHAlloc(dwSize); + if (!pFileDetails) + { + ERR("No memory\n"); + return FALSE; + } + + if (!GetDeletedFileDetailsW(hDeletedFile, + dwSize, + pFileDetails, + NULL)) + { + ERR("GetDeletedFileDetailsW failed\n"); + SHFree(pFileDetails); + return FALSE; + } + + ret = memcmp(pFileDetails, pContext->pFileDetails, dwSize); + if (!ret) + { + pContext->hDeletedFile = hDeletedFile; + pContext->bFound = TRUE; + } + else + CloseRecycleBinHandle(hDeletedFile); + + SHFree(pFileDetails); + return ret; +} + + BOOL WINAPI @@ -286,7 +332,6 @@ LPITEMIDLIST pidl = NULL; BOOL ret; - TRACE("CBEnumBitBucket entered\n"); if (!GetDeletedFileDetailsW(hDeletedFile, 0, NULL, @@ -561,6 +606,26 @@ { FIXME("stub\n"); return E_NOTIMPL; +} + +static HRESULT FormatDateTime(LPWSTR buffer, int size, FILETIME * ft) +{ + FILETIME lft; + SYSTEMTIME time; + int ret; + + FileTimeToLocalFileTime(ft, &lft); + FileTimeToSystemTime(&lft, &time); + + ret = GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &time, NULL, buffer, size); + if (ret>0 && ret<size) + { + /* Append space + time without seconds */ + buffer[ret-1] = ' '; + GetTimeFormatW(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &time, NULL, &buffer[ret], size - ret); + } + + return (ret!=0 ? E_FAIL : S_OK); } static HRESULT WINAPI RecycleBin_GetDetailsOf(IShellFolder2 *iface, LPCITEMIDLIST pidl, UINT iColumn, LPSHELLDETAILS pDetails) @@ -1018,9 +1083,47 @@ IContextMenu2 *iface, LPCMINVOKECOMMANDINFO lpcmi) { + + SEARCH_CONTEXT Context; RecycleBin * This = impl_from_IContextMenu2(iface); + static LPCWSTR szDrive = L"C:\\"; TRACE("(%p)->(invcom=%p verb=%p wnd=%p)\n",This,lpcmi,lpcmi->lpVerb, lpcmi->hwnd); + + if (lpcmi->lpVerb == MAKEINTRESOURCE(1) || lpcmi->lpVerb == MAKEINTRESOURCE(5)) + { + Context.pFileDetails = _ILGetRecycleStruct(This->apidl); + Context.bFound = FALSE; + + EnumerateRecycleBinW(szDrive, CBSearchBitBucket, (PVOID)&Context); + if (!Context.bFound) + return E_FAIL; + + if (lpcmi->lpVerb == MAKEINTRESOURCE(1)) + { + /* restore file */ + if (RestoreFile(Context.hDeletedFile)) + return S_OK; + else + return E_FAIL; + } + else + { + FIXME("implement delete\n"); + CloseRecycleBinHandle(Context.hDeletedFile); + return E_NOTIMPL; + } + } + else if (lpcmi->lpVerb == MAKEINTRESOURCE(3)) + { + FIXME("implement cut\n"); + return E_NOTIMPL; + } + else if (lpcmi->lpVerb == MAKEINTRESOURCE(7)) + { + FIXME("implement properties\n"); + return E_NOTIMPL; + } return S_OK; } @@ -1098,9 +1201,10 @@ WCHAR CurDrive = L'A'; WCHAR szDrive[] = L"A:\\"; DWORD dwDrives; - WCHAR szName[30]; + WCHAR szName[100]; WCHAR szVolume[100]; DWORD MaxComponent, Flags; + DWORD dwSerial; LVCOLUMNW lc; HWND hDlgCtrl; LVITEMW li; @@ -1109,7 +1213,8 @@ RECT rect; int columnSize; int defIndex = 0; - DWORD dwNukeOnDelete, dwSize; + DWORD dwSize; + PDRIVE_ITEM_CONTEXT pItem = NULL, pDefault = NULL, pFirst = NULL; hDlgCtrl = GetDlgItem(hwndDlg, 14000); @@ -1147,23 +1252,45 @@ UINT Type = GetDriveTypeW(szDrive); if (Type == DRIVE_FIXED) //FIXME { - if (!GetVolumeInformationW(szDrive, szName, sizeof(szName) / sizeof(WCHAR), NULL, &MaxComponent, &Flags, NULL, 0)) + if (!GetVolumeInformationW(szDrive, szName, sizeof(szName) / sizeof(WCHAR), &dwSerial, &MaxComponent, &Flags, NULL, 0)) { szName[0] = 0; + dwSerial = -1; } + sprintfW(szVolume, L"%s (%c)", szName, szDrive[0]); memset(&li, 0x0, sizeof(LVITEMW)); li.mask = LVIF_TEXT | LVIF_PARAM; li.iSubItem = 0; li.pszText = szVolume; li.iItem = itemCount; - li.lParam = CurDrive; (void)ListView_InsertItemW(hDlgCtrl, &li); if (GetDiskFreeSpaceExW(szDrive, &FreeBytesAvailable , &TotalNumberOfBytes, &TotalNumberOfFreeBytes)) { if (StrFormatByteSizeW(TotalNumberOfFreeBytes.QuadPart, szVolume, sizeof(szVolume) / sizeof(WCHAR))) { - memset(&li, 0x0, sizeof(LVITEMW)); + + pItem = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DRIVE_ITEM_CONTEXT)); + if (pItem) + { + sprintfW(szName, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Bitbucket\\Volume\\%04X-%04X", LOWORD(dwSerial), HIWORD(dwSerial)); + dwSize = sizeof(DWORD); + RegGetValueW(HKEY_CURRENT_USER, szName, L"MaxCapacity", RRF_RT_DWORD, NULL, &pItem->dwMaxCapacity, &dwSize); + dwSize = sizeof(DWORD); + RegGetValueW(HKEY_CURRENT_USER, szName, L"NukeOnDelete", RRF_RT_DWORD, NULL, &pItem->dwNukeOnDelete, &dwSize); + pItem->dwSerial = dwSerial; + li.mask = LVIF_PARAM; + li.lParam = (LPARAM)pItem; + (void)ListView_SetItemW(hDlgCtrl, &li); + if (CurDrive == DefaultDrive) + { + defIndex = itemCount; + pDefault = pItem; + } + } + if (!pFirst) + pFirst = pItem; + li.mask = LVIF_TEXT; li.iSubItem = 1; li.pszText = szVolume; @@ -1171,12 +1298,6 @@ (void)ListView_SetItemW(hDlgCtrl, &li); } } - - if (CurDrive == DefaultDrive) - { - defIndex = itemCount; - } - itemCount++; } } @@ -1185,25 +1306,112 @@ dwDrives = (dwDrives >> 1); }while(dwDrives); + if (!pDefault) + pDefault = pFirst; + if (pDefault) + { + toggleNukeOnDeleteOption(hwndDlg, pDefault->dwNukeOnDelete); + SetDlgItemInt(hwndDlg, 14002, pDefault->dwMaxCapacity, FALSE); + } + ZeroMemory(&li, sizeof(li)); li.mask = LVIF_STATE; - li.state = LVIS_FOCUSED; + li.stateMask = (UINT)-1; + li.state = LVIS_FOCUSED|LVIS_SELECTED; li.iItem = defIndex; (void)ListView_SetItemW(hDlgCtrl, &li); - wcscpy(szVolume, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Bitbucket\\c"); - szVolume[62] = DefaultDrive; - - dwSize = sizeof(dwNukeOnDelete); - if (RegGetValueW(HKEY_LOCAL_MACHINE, szVolume, L"NukeOnDelete", RRF_RT_REG_DWORD, NULL, &dwNukeOnDelete, &dwSize) == ERROR_SUCCESS) +} + +static BOOL StoreDriveSettings(HWND hwndDlg) +{ + int iCount, iIndex; + HWND hDlgCtrl = GetDlgItem(hwndDlg, 14000); + LVITEMW li; + PDRIVE_ITEM_CONTEXT pItem; + HKEY hKey, hSubKey; + WCHAR szSerial[20]; + DWORD dwSize; + + + if (RegOpenKeyExW(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Bitbucket\\Volume", 0, KEY_WRITE, &hKey) != ERROR_SUCCESS) + return FALSE; + + iCount = ListView_GetItemCount(hDlgCtrl); + + ZeroMemory(&li, sizeof(li)); + li.mask = LVIF_PARAM; + + for(iIndex = 0; iIndex < iCount; iIndex++) { - toggleNukeOnDeleteOption(hwndDlg, dwNukeOnDelete); + li.iItem = iIndex; + if (ListView_GetItemW(hDlgCtrl, &li)) + { + pItem = (PDRIVE_ITEM_CONTEXT)li.lParam; + sprintfW(szSerial, L"%04X-%04X", LOWORD(pItem->dwSerial), HIWORD(pItem->dwSerial)); + if (RegCreateKeyExW(hKey, szSerial, 0, NULL, 0, KEY_WRITE, NULL, &hSubKey, NULL) == ERROR_SUCCESS) + { + dwSize = sizeof(DWORD); + RegSetValueExW(hSubKey, L"NukeOnDelete", 0, REG_DWORD, (LPVOID)&pItem->dwNukeOnDelete, dwSize); + dwSize = sizeof(DWORD); + RegSetValueExW(hSubKey, L"MaxCapacity", 0, REG_DWORD, (LPVOID)&pItem->dwMaxCapacity, dwSize); + RegCloseKey(hSubKey); + } + } } - else + RegCloseKey(hKey); + return TRUE; + +} + +static VOID FreeDriveItemContext(HWND hwndDlg) +{ + int iCount, iIndex; + HWND hDlgCtrl = GetDlgItem(hwndDlg, 14000); + LVITEMW li; + + iCount = ListView_GetItemCount(hDlgCtrl); + + ZeroMemory(&li, sizeof(li)); + li.mask = LVIF_PARAM; + + for(iIndex = 0; iIndex < iCount; iIndex++) { - /* default to NukeOnDelete - */ - toggleNukeOnDeleteOption(hwndDlg, TRUE); + li.iItem = iIndex; + if (ListView_GetItemW(hDlgCtrl, &li)) + { + HeapFree(GetProcessHeap(), 0, (LPVOID)li.lParam); + } } +} + +INT +GetDefaultItem(HWND hwndDlg, LVITEMW * li) +{ + HWND hDlgCtrl; + UINT iItemCount, iIndex; + + hDlgCtrl = GetDlgItem(hwndDlg, 14000); + if (!hDlgCtrl) + return -1; + + iItemCount = ListView_GetItemCount(hDlgCtrl); + if (!iItemCount) + return -1; + + ZeroMemory(li, sizeof(LVITEMW)); + li->mask = LVIF_PARAM | LVIF_STATE; + li->stateMask = (UINT)-1; + for (iIndex = 0; iIndex < iItemCount; iIndex++) + { + li->iItem = iIndex; + if (ListView_GetItemW(hDlgCtrl, li)) + { + if (li->state & LVIS_SELECTED) + return iIndex; + } + } + return -1; + } INT_PTR @@ -1215,12 +1423,23 @@ LPARAM lParam ) { + LPPSHNOTIFY lppsn; + LPNMLISTVIEW lppl; + LVITEMW li; + PDRIVE_ITEM_CONTEXT pItem; + BOOL bSuccess; + UINT uResult; + switch(uMsg) { case WM_INITDIALOG: InitializeBitBucketDlg(hwndDlg, (WCHAR)lParam); + if (GetDlgCtrlID((HWND)wParam) != 14000) + { + SetFocus(GetDlgItem(hwndDlg, 14000)); + return FALSE; + } return TRUE; - case WM_COMMAND: switch(LOWORD(wParam)) { @@ -1237,6 +1456,67 @@ break; } break; + case WM_NOTIFY: + lppsn = (LPPSHNOTIFY) lParam; + lppl = (LPNMLISTVIEW) lParam; + if (lppsn->hdr.code == PSN_APPLY) + { + if (GetDefaultItem(hwndDlg, &li) > -1) + { + pItem = (PDRIVE_ITEM_CONTEXT)li.lParam; + if (pItem) + { + uResult = GetDlgItemInt(hwndDlg, 14002, &bSuccess, FALSE); + if (bSuccess) + pItem->dwMaxCapacity = uResult; + if (SendDlgItemMessageW(hwndDlg, 14003, BM_GETCHECK, 0, 0) == BST_CHECKED) + pItem->dwNukeOnDelete = TRUE; + else + pItem->dwNukeOnDelete = FALSE; + } + } + if (StoreDriveSettings(hwndDlg)) + { + SetWindowLong( hwndDlg, DWL_MSGRESULT, PSNRET_NOERROR ); + return TRUE; + } + } + else if (lppl->hdr.code == LVN_ITEMCHANGING) + { + ZeroMemory(&li, sizeof(li)); + li.mask = LVIF_PARAM; + li.iItem = lppl->iItem; + if (!ListView_GetItemW(lppl->hdr.hwndFrom, &li)) + return TRUE; + + pItem = (PDRIVE_ITEM_CONTEXT)li.lParam; + if (!pItem) + return TRUE; + + if (!(lppl->uOldState & LVIS_FOCUSED) && (lppl->uNewState & LVIS_FOCUSED)) + { + /* new focused item */ + toggleNukeOnDeleteOption(lppl->hdr.hwndFrom, pItem->dwNukeOnDelete); + SetDlgItemInt(hwndDlg, 14002, pItem->dwMaxCapacity, FALSE); + } + else if ((lppl->uOldState & LVIS_FOCUSED) && !(lppl->uNewState & LVIS_FOCUSED)) + { + /* kill focus */ + uResult = GetDlgItemInt(hwndDlg, 14002, &bSuccess, FALSE); + if (bSuccess) + pItem->dwMaxCapacity = uResult; + if (SendDlgItemMessageW(hwndDlg, 14003, BM_GETCHECK, 0, 0) == BST_CHECKED) + pItem->dwNukeOnDelete = TRUE; + else + pItem->dwNukeOnDelete = FALSE; + } + return TRUE; + + } + break; + case WM_DESTROY: + FreeDriveItemContext(hwndDlg); + break; } return FALSE; } @@ -1306,7 +1586,7 @@ sprintfW(szBuffer, L"%04X-%04X", LOWORD(VolSerialNumber), HIWORD(VolSerialNumber)); wcscat(szKey, szBuffer); - if (RegCreateKeyExW(HKEY_CURRENT_USER, szBuffer, 0, NULL, 0, KEY_WRITE, NULL, &hKey, &dwDisposition) != ERROR_SUCCESS) + if (RegCreateKeyExW(HKEY_CURRENT_USER, szKey, 0, NULL, 0, KEY_WRITE, NULL, &hKey, &dwDisposition) != ERROR_SUCCESS) { ERR("RegCreateKeyExW failed\n"); return FALSE; @@ -1319,7 +1599,7 @@ RegSetValueExW(hKey, L"NukeOnDelete", 0, REG_DWORD, (LPBYTE)&dwNukeOnDelete, sizeof(DWORD)); /* per default unlimited size */ dwSize = -1; - RegSetValueExW(hKey, L"MaxSize", 0, REG_DWORD, (LPBYTE)&dwSize, sizeof(DWORD)); + RegSetValueExW(hKey, L"MaxCapacity", 0, REG_DWORD, (LPBYTE)&dwSize, sizeof(DWORD)); RegCloseKey(hKey); return TRUE; } @@ -1329,25 +1609,25 @@ ret = RegQueryValueExW(hKey, L"NukeOnDelete", NULL, &dwType, (LPBYTE)&dwNukeOnDelete, &dwSize); if (ret != ERROR_SUCCESS) { - sprintfW(szBuffer, L"ret %u\n", ret); - MessageBoxW(NULL, szBuffer, NULL, MB_OK); - RegCloseKey(hKey); if (ret == ERROR_FILE_NOT_FOUND) { /* restore key and enable bitbucket */ dwNukeOnDelete = 0; RegSetValueExW(hKey, L"NukeOnDelete", 0, REG_DWORD, (LPBYTE)&dwNukeOnDelete, sizeof(DWORD)); } + RegCloseKey(hKey); return TRUE; } else if (dwNukeOnDelete) { /* do not delete to bitbucket */ + RegCloseKey(hKey); return FALSE; } /* FIXME * check if bitbucket is full */ + RegCloseKey(hKey); return TRUE; } }
16 years, 2 months
1
0
0
0
[fireball] 35269: - NDK Fix: DirectoryTableBase member of KPROCESS is ULONG[2] and not LARGE_INTEGER since Windows 2000 ("Inside Windows 2000", Chapter 6), and till Windows 2003.
by fireball@svn.reactos.org
Author: fireball Date: Mon Aug 11 03:40:52 2008 New Revision: 35269 URL:
http://svn.reactos.org/svn/reactos?rev=35269&view=rev
Log: - NDK Fix: DirectoryTableBase member of KPROCESS is ULONG[2] and not LARGE_INTEGER since Windows 2000 ("Inside Windows 2000", Chapter 6), and till Windows 2003. Modified: trunk/reactos/include/ndk/ketypes.h trunk/reactos/ntoskrnl/include/internal/ke.h trunk/reactos/ntoskrnl/include/internal/mm.h trunk/reactos/ntoskrnl/ke/i386/kiinit.c trunk/reactos/ntoskrnl/ke/procobj.c trunk/reactos/ntoskrnl/mm/i386/page.c trunk/reactos/ntoskrnl/mm/mminit.c trunk/reactos/ntoskrnl/ps/process.c Modified: trunk/reactos/include/ndk/ketypes.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/ketypes.h?rev=…
============================================================================== --- trunk/reactos/include/ndk/ketypes.h [iso-8859-1] (original) +++ trunk/reactos/include/ndk/ketypes.h [iso-8859-1] Mon Aug 11 03:40:52 2008 @@ -955,7 +955,7 @@ ULONG DirectoryTableBase; ULONG Unused0; #else - LARGE_INTEGER DirectoryTableBase; + ULONG DirectoryTableBase[2]; #endif #if defined(_M_IX86) KGDTENTRY LdtDescriptor; Modified: trunk/reactos/ntoskrnl/include/internal/ke.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/ke.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/ke.h [iso-8859-1] Mon Aug 11 03:40:52 2008 @@ -537,7 +537,7 @@ struct _KPROCESS *Process, KPRIORITY Priority, KAFFINITY Affinity, - PLARGE_INTEGER DirectoryTableBase, + PULONG DirectoryTableBase, IN BOOLEAN Enable ); Modified: trunk/reactos/ntoskrnl/include/internal/mm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] Mon Aug 11 03:40:52 2008 @@ -1275,14 +1275,14 @@ MmCreateProcessAddressSpace( IN ULONG MinWs, IN PEPROCESS Dest, - IN PLARGE_INTEGER DirectoryTableBase + IN PULONG DirectoryTableBase ); NTSTATUS NTAPI MmInitializeHandBuiltProcess( IN PEPROCESS Process, - IN PLARGE_INTEGER DirectoryTableBase + IN PULONG DirectoryTableBase ); Modified: trunk/reactos/ntoskrnl/ke/i386/kiinit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/kiinit.c?…
============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/kiinit.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/i386/kiinit.c [iso-8859-1] Mon Aug 11 03:40:52 2008 @@ -391,7 +391,7 @@ { BOOLEAN NpxPresent; ULONG FeatureBits; - LARGE_INTEGER PageDirectory; + ULONG PageDirectory[2]; PVOID DpcStack; ULONG Vendor[3]; @@ -503,11 +503,12 @@ /* Initialize the Idle Process and the Process Listhead */ InitializeListHead(&KiProcessListHead); - PageDirectory.QuadPart = 0; + PageDirectory[0] = 0; + PageDirectory[1] = 0; KeInitializeProcess(InitProcess, 0, 0xFFFFFFFF, - &PageDirectory, + PageDirectory, FALSE); InitProcess->QuantumReset = MAXCHAR; } Modified: trunk/reactos/ntoskrnl/ke/procobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/procobj.c?rev=…
============================================================================== --- trunk/reactos/ntoskrnl/ke/procobj.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/procobj.c [iso-8859-1] Mon Aug 11 03:40:52 2008 @@ -115,7 +115,7 @@ KeInitializeProcess(IN OUT PKPROCESS Process, IN KPRIORITY Priority, IN KAFFINITY Affinity, - IN PLARGE_INTEGER DirectoryTableBase, + IN PULONG DirectoryTableBase, IN BOOLEAN Enable) { #ifdef CONFIG_SMP @@ -134,7 +134,8 @@ Process->Affinity = Affinity; Process->BasePriority = (CHAR)Priority; Process->QuantumReset = 6; - Process->DirectoryTableBase = *DirectoryTableBase; + Process->DirectoryTableBase[0] = DirectoryTableBase[0]; + Process->DirectoryTableBase[1] = DirectoryTableBase[1]; Process->AutoAlignment = Enable; #if defined(_M_IX86) Process->IopmOffset = KiComputeIopmOffset(IO_ACCESS_MAP_NONE); Modified: trunk/reactos/ntoskrnl/mm/i386/page.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/i386/page.c?re…
============================================================================== --- trunk/reactos/ntoskrnl/mm/i386/page.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/i386/page.c [iso-8859-1] Mon Aug 11 03:40:52 2008 @@ -162,7 +162,7 @@ ExFreePool((PVOID) LdtBase); } - PageDir = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase.u.LowPart)); + PageDir = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase[0])); for (i = 0; i < ADDR_TO_PDE_OFFSET(MmSystemRangeStart); i++) { if (PageDir[i] != 0) @@ -173,16 +173,11 @@ } MmReleasePageMemoryConsumer(MC_NPPOOL, PTE_TO_PFN(PageDir[ADDR_TO_PDE_OFFSET(HYPERSPACE)])); MmDeleteHyperspaceMapping(PageDir); - MmReleasePageMemoryConsumer(MC_NPPOOL, PTE_TO_PFN(Process->Pcb.DirectoryTableBase.u.LowPart)); - -#if defined(__GNUC__) - - Process->Pcb.DirectoryTableBase.QuadPart = 0LL; -#else - - Process->Pcb.DirectoryTableBase.QuadPart = 0; -#endif - + MmReleasePageMemoryConsumer(MC_NPPOOL, PTE_TO_PFN(Process->Pcb.DirectoryTableBase[0])); + + Process->Pcb.DirectoryTableBase[0] = 0; + Process->Pcb.DirectoryTableBase[1] = 0; + DPRINT("Finished Mmi386ReleaseMmInfo()\n"); return(STATUS_SUCCESS); } @@ -190,15 +185,16 @@ NTSTATUS NTAPI MmInitializeHandBuiltProcess(IN PEPROCESS Process, - IN PLARGE_INTEGER DirectoryTableBase) + IN PULONG DirectoryTableBase) { /* Share the directory base with the idle process */ - *DirectoryTableBase = PsGetCurrentProcess()->Pcb.DirectoryTableBase; - + DirectoryTableBase[0] = PsGetCurrentProcess()->Pcb.DirectoryTableBase[0]; + DirectoryTableBase[1] = PsGetCurrentProcess()->Pcb.DirectoryTableBase[1]; + /* Initialize the Addresss Space */ KeInitializeGuardedMutex(&Process->AddressCreationLock); Process->VadRoot.BalancedRoot.u1.Parent = NULL; - + /* The process now has an address space */ Process->HasAddressSpace = TRUE; return STATUS_SUCCESS; @@ -208,7 +204,7 @@ STDCALL MmCreateProcessAddressSpace(IN ULONG MinWs, IN PEPROCESS Process, - IN PLARGE_INTEGER DirectoryTableBase) + IN PULONG DirectoryTableBase) { NTSTATUS Status; ULONG i, j; @@ -243,8 +239,9 @@ MmDeleteHyperspaceMapping(PageDirectory); - DirectoryTableBase->QuadPart = PFN_TO_PTE(Pfn[0]); - DPRINT("Finished MmCopyMmInfo(): %I64x\n", DirectoryTableBase->QuadPart); + DirectoryTableBase[0] = PFN_TO_PTE(Pfn[0]); + DirectoryTableBase[1] = 0; + DPRINT("Finished MmCopyMmInfo(): 0x%x\n", DirectoryTableBase[0]); return TRUE; } @@ -329,7 +326,7 @@ if (Address < MmSystemRangeStart && Process && Process != PsGetCurrentProcess()) { - PageDir = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase.LowPart)); + PageDir = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase[0])); if (PageDir == NULL) { KEBUGCHECK(0); @@ -1286,7 +1283,7 @@ if (Process != NULL && Process != PsGetCurrentProcess()) { - Pde = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase.u.LowPart)); + Pde = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase[0])); } else { Modified: trunk/reactos/ntoskrnl/mm/mminit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/mminit.c?rev=3…
============================================================================== --- trunk/reactos/ntoskrnl/mm/mminit.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/mminit.c [iso-8859-1] Mon Aug 11 03:40:52 2008 @@ -368,13 +368,13 @@ MmInit1(VOID) { PLDR_DATA_TABLE_ENTRY LdrEntry; - LARGE_INTEGER Dummy; + ULONG Dummy[2]; /* Dump memory descriptors */ if (MiDbgEnableMdDump) MiDbgDumpMemoryDescriptors(); /* Set the page directory */ - PsGetCurrentProcess()->Pcb.DirectoryTableBase.LowPart = (ULONG)MmGetPageDirectory(); + PsGetCurrentProcess()->Pcb.DirectoryTableBase[0] = (ULONG)MmGetPageDirectory(); /* Get the size of FreeLDR's image allocations */ MmBootImageSize = KeLoaderBlock->Extension->LoaderPagesSpanned; @@ -396,7 +396,7 @@ DbgPrint("Used memory %dKb\n", (MmNumberOfPhysicalPages * PAGE_SIZE) / 1024); /* Initialize the kernel address space */ - MmInitializeHandBuiltProcess(PsGetCurrentProcess(), &Dummy); + MmInitializeHandBuiltProcess(PsGetCurrentProcess(), Dummy); MmKernelAddressSpace = MmGetCurrentAddressSpace(); MmInitGlobalKernelPageDirectory(); Modified: trunk/reactos/ntoskrnl/ps/process.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/process.c?rev=…
============================================================================== --- trunk/reactos/ntoskrnl/ps/process.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ps/process.c [iso-8859-1] Mon Aug 11 03:40:52 2008 @@ -365,7 +365,7 @@ PDEBUG_OBJECT DebugObject; PSECTION_OBJECT SectionObject; NTSTATUS Status, AccessStatus; - PHYSICAL_ADDRESS DirectoryTableBase = {{0}}; + ULONG DirectoryTableBase[2] = {0,0}; KAFFINITY Affinity; HANDLE_TABLE_ENTRY CidEntry; PETHREAD CurrentThread = PsGetCurrentThread(); @@ -562,7 +562,7 @@ /* Create the address space for the child */ if (!MmCreateProcessAddressSpace(MinWs, Process, - &DirectoryTableBase)) + DirectoryTableBase)) { /* Failed */ Status = STATUS_INSUFFICIENT_RESOURCES; @@ -573,7 +573,7 @@ { /* Otherwise, we are the boot process, we're already semi-initialized */ Process->ObjectTable = CurrentProcess->ObjectTable; - Status = MmInitializeHandBuiltProcess(Process, &DirectoryTableBase); + Status = MmInitializeHandBuiltProcess(Process, DirectoryTableBase); if (!NT_SUCCESS(Status)) goto CleanupWithRef; } @@ -587,7 +587,7 @@ KeInitializeProcess(&Process->Pcb, PROCESS_PRIORITY_NORMAL, Affinity, - &DirectoryTableBase, + DirectoryTableBase, (BOOLEAN)(Process->DefaultHardErrorProcessing & 4)); /* Duplicate Parent Token */
16 years, 2 months
1
0
0
0
[arty] 35268: Forgotten edit from trunk.
by arty@svn.reactos.org
Author: arty Date: Mon Aug 11 01:26:55 2008 New Revision: 35268 URL:
http://svn.reactos.org/svn/reactos?rev=35268&view=rev
Log: Forgotten edit from trunk. Modified: branches/arty-newcc/lib/rtl/bitmap.c Modified: branches/arty-newcc/lib/rtl/bitmap.c URL:
http://svn.reactos.org/svn/reactos/branches/arty-newcc/lib/rtl/bitmap.c?rev…
============================================================================== --- branches/arty-newcc/lib/rtl/bitmap.c [iso-8859-1] (original) +++ branches/arty-newcc/lib/rtl/bitmap.c [iso-8859-1] Mon Aug 11 01:26:55 2008 @@ -867,14 +867,14 @@ RtlTestBit(PRTL_BITMAP BitMapHeader, ULONG BitNumber) { - PULONG Ptr; + PUCHAR Ptr; if (BitNumber >= BitMapHeader->SizeOfBitMap) return FALSE; - Ptr = (PULONG)BitMapHeader->Buffer + (BitNumber / 32); - - return (BOOLEAN)(*Ptr & (1 << (BitNumber % 32))); + Ptr = (PUCHAR)BitMapHeader->Buffer + (BitNumber / 8); + + return (BOOLEAN)(*Ptr & (1 << (BitNumber % 8))); } /*
16 years, 2 months
1
0
0
0
[arty] 35267: Merge aicom-network-fixes up to 35260
by arty@svn.reactos.org
Author: arty Date: Sun Aug 10 19:02:26 2008 New Revision: 35267 URL:
http://svn.reactos.org/svn/reactos?rev=35267&view=rev
Log: Merge aicom-network-fixes up to 35260 Modified: trunk/reactos/drivers/network/afd/afd/select.c trunk/reactos/drivers/network/afd/afd/tdi.c trunk/reactos/drivers/network/afd/include/afd.h Modified: trunk/reactos/drivers/network/afd/afd/select.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/se…
============================================================================== --- trunk/reactos/drivers/network/afd/afd/select.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/afd/afd/select.c [iso-8859-1] Sun Aug 10 19:02:26 2008 @@ -85,6 +85,7 @@ PollReq->Handles[i].Status)); } UnlockHandles( AFD_HANDLES(PollReq), PollReq->HandleCount ); + if( Irp->MdlAddress ) UnlockRequest( Irp, IoGetCurrentIrpStackLocation( Irp ) ); AFD_DbgPrint(MID_TRACE,("Completing\n")); IoCompleteRequest( Irp, IO_NETWORK_INCREMENT ); AFD_DbgPrint(MID_TRACE,("Done\n")); @@ -391,6 +392,11 @@ /* Take care of any event select signalling */ FCB = (PAFD_FCB)FileObject->FsContext; + if( !FCB ) { + KeReleaseSpinLock( &DeviceExt->Lock, OldIrql ); + return; + } + /* Not sure if i can do this at DISPATCH_LEVEL ... try it at passive */ AFD_DbgPrint(MID_TRACE,("Current State: %x, Events Fired: %x, " "Select Triggers %x\n", @@ -401,11 +407,6 @@ EventSelect = FCB->EventSelect; } - if( !FCB ) { - KeReleaseSpinLock( &DeviceExt->Lock, OldIrql ); - return; - } - /* Now signal normal select irps */ ThePollEnt = DeviceExt->Polls.Flink; Modified: trunk/reactos/drivers/network/afd/afd/tdi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/td…
============================================================================== --- trunk/reactos/drivers/network/afd/afd/tdi.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/afd/afd/tdi.c [iso-8859-1] Sun Aug 10 19:02:26 2008 @@ -631,7 +631,6 @@ return Status; } -#if 0 NTSTATUS TdiQueryInformationEx( PFILE_OBJECT FileObject, ULONG Entity, @@ -807,7 +806,6 @@ return Status; } -#endif NTSTATUS TdiSend ( PIRP *Irp, Modified: trunk/reactos/drivers/network/afd/include/afd.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/includ…
============================================================================== --- trunk/reactos/drivers/network/afd/include/afd.h [iso-8859-1] (original) +++ trunk/reactos/drivers/network/afd/include/afd.h [iso-8859-1] Sun Aug 10 19:02:26 2008 @@ -27,6 +27,55 @@ #ifndef MIN #define MIN(x,y) (((x)<(y))?(x):(y)) #endif + +#define IOCTL_TCP_QUERY_INFORMATION_EX \ + CTL_CODE(FILE_DEVICE_NETWORK, 0, METHOD_NEITHER, FILE_ANY_ACCESS) + +#define TL_INSTANCE 0 +#define IP_MIB_STATS_ID 1 +#define IP_MIB_ADDRTABLE_ENTRY_ID 0x102 + +typedef struct IPSNMP_INFO { + ULONG Forwarding; + ULONG DefaultTTL; + ULONG InReceives; + ULONG InHdrErrors; + ULONG InAddrErrors; + ULONG ForwDatagrams; + ULONG InUnknownProtos; + ULONG InDiscards; + ULONG InDelivers; + ULONG OutRequests; + ULONG RoutingDiscards; + ULONG OutDiscards; + ULONG OutNoRoutes; + ULONG ReasmTimeout; + ULONG ReasmReqds; + ULONG ReasmOks; + ULONG ReasmFails; + ULONG FragOks; + ULONG FragFails; + ULONG FragCreates; + ULONG NumIf; + ULONG NumAddr; + ULONG NumRoutes; +} IPSNMP_INFO, *PIPSNMP_INFO; + +typedef struct IPADDR_ENTRY { + ULONG Addr; + ULONG Index; + ULONG Mask; + ULONG BcastAddr; + ULONG ReasmSize; + USHORT Context; + USHORT Pad; +} IPADDR_ENTRY, *PIPADDR_ENTRY; + +#define DN2H(dw) \ + ((((dw) & 0xFF000000L) >> 24) | \ + (((dw) & 0x00FF0000L) >> 8) | \ + (((dw) & 0x0000FF00L) << 8) | \ + (((dw) & 0x000000FFL) << 24)) #define SOCKET_STATE_INVALID_TRANSITION ((DWORD)-1) #define SOCKET_STATE_CREATED 0
16 years, 2 months
1
0
0
0
[fireball] 35266: - .def -> .spec
by fireball@svn.reactos.org
Author: fireball Date: Sun Aug 10 13:06:21 2008 New Revision: 35266 URL:
http://svn.reactos.org/svn/reactos?rev=35266&view=rev
Log: - .def -> .spec Added: trunk/rosapps/applications/screensavers/blankscr/scrnsave.spec (contents, props changed) - copied, changed from r35264, trunk/rosapps/applications/screensavers/blankscr/scrnsave.def trunk/rosapps/applications/screensavers/butterflies/butterflies.spec (contents, props changed) - copied, changed from r35264, trunk/rosapps/applications/screensavers/butterflies/butterflies.def Removed: trunk/rosapps/applications/screensavers/blankscr/scrnsave.def trunk/rosapps/applications/screensavers/butterflies/butterflies.def Modified: trunk/rosapps/applications/screensavers/blankscr/blankscr.rbuild trunk/rosapps/applications/screensavers/butterflies/butterflies.rbuild Modified: trunk/rosapps/applications/screensavers/blankscr/blankscr.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/screensavers/…
============================================================================== --- trunk/rosapps/applications/screensavers/blankscr/blankscr.rbuild [iso-8859-1] (original) +++ trunk/rosapps/applications/screensavers/blankscr/blankscr.rbuild [iso-8859-1] Sun Aug 10 13:06:21 2008 @@ -1,7 +1,7 @@ <?xml version="1.0"?> <!DOCTYPE module SYSTEM "../../../../tools/rbuild/project.dtd"> <module name="blankscr" type="win32scr" installbase="system32" installname="scrnsave.scr" unicode="yes"> - <importlibrary definition="scrnsave.def" /> + <importlibrary definition="scrnsave.spec.def" /> <library>scrnsave</library> <library>kernel32</library> <library>user32</library> @@ -9,4 +9,5 @@ <file>scrnsave.c</file> <file>scrnsave.rc</file> + <file>scrnsave.spec</file> </module> Removed: trunk/rosapps/applications/screensavers/blankscr/scrnsave.def URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/screensavers/…
============================================================================== --- trunk/rosapps/applications/screensavers/blankscr/scrnsave.def [iso-8859-1] (original) +++ trunk/rosapps/applications/screensavers/blankscr/scrnsave.def (removed) @@ -1,5 +1,0 @@ -NAME blankscr.SCR - -EXPORTS - ScreenSaverProc - ScreenSaverConfigureDialog Copied: trunk/rosapps/applications/screensavers/blankscr/scrnsave.spec (from r35264, trunk/rosapps/applications/screensavers/blankscr/scrnsave.def) URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/screensavers/…
============================================================================== --- trunk/rosapps/applications/screensavers/blankscr/scrnsave.def [iso-8859-1] (original) +++ trunk/rosapps/applications/screensavers/blankscr/scrnsave.spec [iso-8859-1] Sun Aug 10 13:06:21 2008 @@ -1,5 +1,2 @@ -NAME blankscr.SCR - -EXPORTS - ScreenSaverProc - ScreenSaverConfigureDialog +@ stdcall ScreenSaverProc(ptr long ptr ptr) +@ stdcall ScreenSaverConfigureDialog(ptr long ptr ptr) Propchange: trunk/rosapps/applications/screensavers/blankscr/scrnsave.spec ------------------------------------------------------------------------------ svn:eol-style = native Propchange: trunk/rosapps/applications/screensavers/blankscr/scrnsave.spec ------------------------------------------------------------------------------ svn:mergeinfo = Removed: trunk/rosapps/applications/screensavers/butterflies/butterflies.def URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/screensavers/…
============================================================================== --- trunk/rosapps/applications/screensavers/butterflies/butterflies.def [iso-8859-1] (original) +++ trunk/rosapps/applications/screensavers/butterflies/butterflies.def (removed) @@ -1,10 +1,0 @@ -NAME butterflies.SCR - -DESCRIPTION 'OpenGL Butterflies screen saver' - -HEAPSIZE 1024 -STACKSIZE 4096 - -EXPORTS - ScreenSaverProc - ScreenSaverConfigureDialog Modified: trunk/rosapps/applications/screensavers/butterflies/butterflies.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/screensavers/…
============================================================================== --- trunk/rosapps/applications/screensavers/butterflies/butterflies.rbuild [iso-8859-1] (original) +++ trunk/rosapps/applications/screensavers/butterflies/butterflies.rbuild [iso-8859-1] Sun Aug 10 13:06:21 2008 @@ -1,7 +1,7 @@ <?xml version="1.0"?> <!DOCTYPE module SYSTEM "../../../../tools/rbuild/project.dtd"> <module name="butterflies" type="win32scr" installbase="system32" installname="butterflies.scr" unicode="yes"> - <importlibrary definition="butterflies.def" /> + <importlibrary definition="butterflies.spec.def" /> <include base="butterflies">.</include> <library>scrnsave</library> <library>kernel32</library> @@ -16,4 +16,5 @@ <file>butterflies.c</file> <file>butterflies.rc</file> + <file>butterflies.spec</file> </module> Copied: trunk/rosapps/applications/screensavers/butterflies/butterflies.spec (from r35264, trunk/rosapps/applications/screensavers/butterflies/butterflies.def) URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/screensavers/…
============================================================================== --- trunk/rosapps/applications/screensavers/butterflies/butterflies.def [iso-8859-1] (original) +++ trunk/rosapps/applications/screensavers/butterflies/butterflies.spec [iso-8859-1] Sun Aug 10 13:06:21 2008 @@ -1,10 +1,2 @@ -NAME butterflies.SCR - -DESCRIPTION 'OpenGL Butterflies screen saver' - -HEAPSIZE 1024 -STACKSIZE 4096 - -EXPORTS - ScreenSaverProc - ScreenSaverConfigureDialog +@ stdcall ScreenSaverProc(ptr long ptr ptr) +@ stdcall ScreenSaverConfigureDialog(ptr long ptr ptr) Propchange: trunk/rosapps/applications/screensavers/butterflies/butterflies.spec ------------------------------------------------------------------------------ svn:eol-style = native Propchange: trunk/rosapps/applications/screensavers/butterflies/butterflies.spec ------------------------------------------------------------------------------ svn:mergeinfo =
16 years, 2 months
1
0
0
0
[fireball] 35265: - Fix dxtn build.
by fireball@svn.reactos.org
Author: fireball Date: Sun Aug 10 11:25:26 2008 New Revision: 35265 URL:
http://svn.reactos.org/svn/reactos?rev=35265&view=rev
Log: - Fix dxtn build. Modified: trunk/reactos/dll/3rdparty/dxtn/internal.h Modified: trunk/reactos/dll/3rdparty/dxtn/internal.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/dxtn/internal…
============================================================================== --- trunk/reactos/dll/3rdparty/dxtn/internal.h [iso-8859-1] (original) +++ trunk/reactos/dll/3rdparty/dxtn/internal.h [iso-8859-1] Sun Aug 10 11:25:26 2008 @@ -29,7 +29,7 @@ #ifdef __WIN32__ #define TAPI __declspec(dllexport) -#define TAPIENTRY /*__stdcall*/ +#define TAPIENTRY __stdcall #else #define TAPI #define TAPIENTRY
16 years, 2 months
1
0
0
0
[gedmurphy] 35264: Give Techbot the ability to check for and ghost existing bots, then rename itself
by gedmurphy@svn.reactos.org
Author: gedmurphy Date: Sun Aug 10 08:06:58 2008 New Revision: 35264 URL:
http://svn.reactos.org/svn/reactos?rev=35264&view=rev
Log: Give Techbot the ability to check for and ghost existing bots, then rename itself Modified: trunk/irc/TechBot/TechBot.IRCLibrary/IRC.cs trunk/irc/TechBot/TechBot.IRCLibrary/IrcClient.cs trunk/irc/TechBot/TechBot.Library/TechBotIrcService.cs Modified: trunk/irc/TechBot/TechBot.IRCLibrary/IRC.cs URL:
http://svn.reactos.org/svn/reactos/trunk/irc/TechBot/TechBot.IRCLibrary/IRC…
============================================================================== --- trunk/irc/TechBot/TechBot.IRCLibrary/IRC.cs [iso-8859-1] (original) +++ trunk/irc/TechBot/TechBot.IRCLibrary/IRC.cs [iso-8859-1] Sun Aug 10 08:06:58 2008 @@ -17,10 +17,12 @@ public const string PRIVMSG = "PRIVMSG"; public const string USER = "USER"; public const string PASS = "PASS"; - public const string GHOST = "MSG NICKSERV GHOST"; + public const string GHOST = "NICKSERV GHOST"; + public const string NOTICE = "NOTICE"; public const string RPL_NAMREPLY = "353"; public const string RPL_ENDOFNAMES = "366"; + public const string ERR_NICKNAMEINUSE = "433"; #endregion Modified: trunk/irc/TechBot/TechBot.IRCLibrary/IrcClient.cs URL:
http://svn.reactos.org/svn/reactos/trunk/irc/TechBot/TechBot.IRCLibrary/Irc…
============================================================================== --- trunk/irc/TechBot/TechBot.IRCLibrary/IrcClient.cs [iso-8859-1] (original) +++ trunk/irc/TechBot/TechBot.IRCLibrary/IrcClient.cs [iso-8859-1] Sun Aug 10 08:06:58 2008 @@ -191,6 +191,7 @@ #region Private fields private bool firstPingReceived = false; + private bool awaitingGhostDeath = false; private System.Text.Encoding encoding = System.Text.Encoding.UTF8; private TcpClient tcpClient; private NetworkStream networkStream; @@ -198,6 +199,9 @@ private LineBuffer messageStream; private ArrayList ircCommandEventRegistrations = new ArrayList(); private ArrayList channels = new ArrayList(); + private string reqNickname; + private string curNickname; + private string password; #endregion #region Public events @@ -240,6 +244,16 @@ } } + /// <summary> + /// Nickname for the bot. + /// </summary> + public string Nickname + { + get + { + return curNickname; + } + } #endregion #region Private methods @@ -361,6 +375,24 @@ firstPingReceived = true; } + /// <summary> + /// Send a PONG message when a PING message is received. + /// </summary> + /// <param name="message">Received IRC message.</param> + private void NoticeMessageReceived(IrcMessage message) + { + if (awaitingGhostDeath) + { + string str = string.Format("{0} has been ghosted", reqNickname); + if (message.Parameters.Contains(str)) + { + ChangeNick(reqNickname); + SubmitPassword(password); + awaitingGhostDeath = false; + } + } + } + /// <summary> /// Process RPL_NAMREPLY message. /// </summary> @@ -472,6 +504,31 @@ } } + /// <summary> + /// Process ERR_NICKNAMEINUSE message. + /// </summary> + /// <param name="message">Received IRC message.</param> + private void ERR_NICKNAMEINUSEMessageReceived(IrcMessage message) + { + try + { + if (message.Parameters == null) + { + System.Diagnostics.Debug.WriteLine(String.Format("Message has no parameters.")); + return; + } + + /* Connect with a different name */ + string[] parameters = message.Parameters.Split(new char[] { ' ' }); + string nickname = parameters[1]; + ChangeNick(nickname + "__"); + } + catch (Exception ex) + { + System.Diagnostics.Debug.WriteLine(String.Format("Ex. {0}", ex)); + } + } + #endregion /// <summary> @@ -500,10 +557,14 @@ } /* Install PING message handler */ MonitorCommand(IRC.PING, new MessageReceivedHandler(PingMessageReceived)); + /* Install NOTICE message handler */ + MonitorCommand(IRC.NOTICE, new MessageReceivedHandler(NoticeMessageReceived)); /* Install RPL_NAMREPLY message handler */ MonitorCommand(IRC.RPL_NAMREPLY, new MessageReceivedHandler(RPL_NAMREPLYMessageReceived)); /* Install RPL_ENDOFNAMES message handler */ MonitorCommand(IRC.RPL_ENDOFNAMES, new MessageReceivedHandler(RPL_ENDOFNAMESMessageReceived)); + /* Install ERR_NICKNAMEINUSE message handler */ + MonitorCommand(IRC.ERR_NICKNAMEINUSE, new MessageReceivedHandler(ERR_NICKNAMEINUSEMessageReceived)); /* Start receiving data */ Receive(); } @@ -520,8 +581,6 @@ } else { - - connected = false; tcpClient.Close(); tcpClient = null; @@ -606,10 +665,32 @@ if (nickname == null) throw new ArgumentNullException("nickname", "Nickname cannot be null."); + Console.WriteLine("Changing nick to {0}\n", nickname); + curNickname = nickname; + /* NICK <nickname> [ <hopcount> ] */ SendMessage(new IrcMessage(IRC.NICK, nickname)); } + /// <summary> + /// Ghost nickname. + /// </summary> + /// <param name="nickname">Nickname.</param> + public void GhostNick(string nickname, + string password) + { + if (nickname == null) + throw new ArgumentNullException("nickname", "Nickname cannot be null."); + + if (password == null) + throw new ArgumentNullException("password", "Password cannot be null."); + + awaitingGhostDeath = true; + + /* GHOST <nickname> <password> */ + SendMessage(new IrcMessage(IRC.GHOST, nickname + " " + password)); + } + /// <summary> /// Submit password to identify user. /// </summary> @@ -618,6 +699,8 @@ { if (password == null) throw new ArgumentNullException("password", "Password cannot be null."); + + this.password = password; /* PASS <password> */ SendMessage(new IrcMessage(IRC.PASS, password)); @@ -635,12 +718,10 @@ { if (nickname == null) throw new ArgumentNullException("nickname", "Nickname cannot be null."); + reqNickname = nickname; firstPingReceived = false; if (password != null) { - /* First ghost ourself and then register */ - if (nickname != null) - SendMessage(new IrcMessage(IRC.GHOST, nickname + " " + password)); SubmitPassword(password); } ChangeNick(nickname); Modified: trunk/irc/TechBot/TechBot.Library/TechBotIrcService.cs URL:
http://svn.reactos.org/svn/reactos/trunk/irc/TechBot/TechBot.Library/TechBo…
============================================================================== --- trunk/irc/TechBot/TechBot.Library/TechBotIrcService.cs [iso-8859-1] (original) +++ trunk/irc/TechBot/TechBot.Library/TechBotIrcService.cs [iso-8859-1] Sun Aug 10 08:06:58 2008 @@ -88,7 +88,15 @@ m_IrcClient.Connect(hostname, port); m_IrcClient.Register(botname, password, null); - Console.WriteLine("Registered as {0}...", botname); + Console.WriteLine("Registered as {0}...", m_IrcClient.Nickname); + + /* Did we get the nick we wanted? */ + if (m_IrcClient.Nickname != botname) + { + /* there must have been an existing one, kill it */ + m_IrcClient.GhostNick(botname, password);; + } + JoinChannels(); while (!isStopped) @@ -279,7 +287,7 @@ injectMessage, GetMessageSource(context))); InjectMessage(context, - injectMessage); + injectMessage); } else {
16 years, 2 months
1
0
0
0
← Newer
1
...
55
56
57
58
59
60
61
...
86
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
Results per page:
10
25
50
100
200