ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
April 2007
----- 2025 -----
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
19 participants
380 discussions
Start a n
N
ew thread
[janderwald] 26263: - move implementation of dialogs to appropiate file (odbccp32.dll) - odbccp32.cpl is therefore complete YUHU - rbuild needs to be hacked that odbccp32.cpl is outputed in the right destination folder (currently it writes into destination of odbccp32.dll)
by janderwald@svn.reactos.org
Author: janderwald Date: Wed Apr 4 22:43:24 2007 New Revision: 26263 URL:
http://svn.reactos.org/svn/reactos?rev=26263&view=rev
Log: - move implementation of dialogs to appropiate file (odbccp32.dll) - odbccp32.cpl is therefore complete YUHU - rbuild needs to be hacked that odbccp32.cpl is outputed in the right destination folder (currently it writes into destination of odbccp32.dll) Removed: trunk/reactos/dll/cpl/odbccp32/about.c trunk/reactos/dll/cpl/odbccp32/drivers.c trunk/reactos/dll/cpl/odbccp32/dsn.c trunk/reactos/dll/cpl/odbccp32/lang/ trunk/reactos/dll/cpl/odbccp32/pool.c trunk/reactos/dll/cpl/odbccp32/resource.h trunk/reactos/dll/cpl/odbccp32/rsrc.rc trunk/reactos/dll/cpl/odbccp32/trace.c Modified: trunk/reactos/dll/cpl/odbccp32/odbccp32.c trunk/reactos/dll/cpl/odbccp32/odbccp32.h trunk/reactos/dll/cpl/odbccp32/odbccp32.rbuild trunk/reactos/dll/cpl/odbccp32/odbccp32.rc Removed: trunk/reactos/dll/cpl/odbccp32/about.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/odbccp32/about.c?r…
============================================================================== --- trunk/reactos/dll/cpl/odbccp32/about.c (original) +++ trunk/reactos/dll/cpl/odbccp32/about.c (removed) @@ -1,23 +1,0 @@ -/* $Id$ - * - * PROJECT: ReactOS ODBC Control Panel Applet - * FILE: lib/cpl/main/main.c - * PURPOSE: ODBC about dialog - * PROGRAMMER: Johannes Anderwald - */ - -#include "odbccp32.h" - -INT_PTR -CALLBACK -AboutProc(IN HWND hwndDlg, - IN UINT uMsg, - IN WPARAM wParam, - IN LPARAM lParam) -{ - - - - - return FALSE; -} Removed: trunk/reactos/dll/cpl/odbccp32/drivers.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/odbccp32/drivers.c…
============================================================================== --- trunk/reactos/dll/cpl/odbccp32/drivers.c (original) +++ trunk/reactos/dll/cpl/odbccp32/drivers.c (removed) @@ -1,23 +1,0 @@ -/* $Id: odbccp32.c 22979 2006-07-09 21:10:40Z fireball $ - * - * PROJECT: ReactOS ODBC Control Panel Applet - * FILE: lib/cpl/main/main.c - * PURPOSE: ODBC drivers dialog - * PROGRAMMER: Johannes Anderwald - */ - -#include "odbccp32.h" - -INT_PTR -CALLBACK -DriversProc(IN HWND hwndDlg, - IN UINT uMsg, - IN WPARAM wParam, - IN LPARAM lParam) -{ - - - - - return FALSE; -} Removed: trunk/reactos/dll/cpl/odbccp32/dsn.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/odbccp32/dsn.c?rev…
============================================================================== --- trunk/reactos/dll/cpl/odbccp32/dsn.c (original) +++ trunk/reactos/dll/cpl/odbccp32/dsn.c (removed) @@ -1,51 +1,0 @@ -/* $Id$ - * - * PROJECT: ReactOS ODBC Control Panel Applet - * FILE: lib/cpl/main/main.c - * PURPOSE: ODBC DSN functions - * PROGRAMMER: Johannes Anderwald - */ - -#include "odbccp32.h" - -INT_PTR -CALLBACK -UserDSNProc(IN HWND hwndDlg, - IN UINT uMsg, - IN WPARAM wParam, - IN LPARAM lParam) -{ - - - - - return FALSE; -} - -INT_PTR -CALLBACK -SystemDSNProc(IN HWND hwndDlg, - IN UINT uMsg, - IN WPARAM wParam, - IN LPARAM lParam) -{ - - - - - return FALSE; -} - -INT_PTR -CALLBACK -FileDSNProc(IN HWND hwndDlg, - IN UINT uMsg, - IN WPARAM wParam, - IN LPARAM lParam) -{ - - - - - return FALSE; -} Modified: trunk/reactos/dll/cpl/odbccp32/odbccp32.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/odbccp32/odbccp32.…
============================================================================== --- trunk/reactos/dll/cpl/odbccp32/odbccp32.c (original) +++ trunk/reactos/dll/cpl/odbccp32/odbccp32.c Wed Apr 4 22:43:24 2007 @@ -8,59 +8,9 @@ #include "odbccp32.h" -HINSTANCE hApplet = 0; - -VOID -InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc) -{ - ZeroMemory(psp, sizeof(PROPSHEETPAGE)); - - psp->dwSize = sizeof(PROPSHEETPAGE); - psp->dwFlags = PSP_DEFAULT; - psp->hInstance = hApplet; - psp->pszTemplate = MAKEINTRESOURCE(idDlg); - psp->pfnDlgProc = DlgProc; -} - - -LONG -APIENTRY -AppletProc(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam) -{ - PROPSHEETPAGE psp[7]; - PROPSHEETHEADER psh; - TCHAR szBuffer[256]; - - UNREFERENCED_PARAMETER(lParam); - UNREFERENCED_PARAMETER(wParam); - UNREFERENCED_PARAMETER(uMsg); - UNREFERENCED_PARAMETER(hwnd); - - ZeroMemory(&psh, sizeof(PROPSHEETHEADER)); - psh.dwFlags = PSH_PROPSHEETPAGE; - psh.dwSize = sizeof(PROPSHEETHEADER); - psh.hwndParent = NULL; - psh.hInstance = hApplet; - psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON)); - psh.nStartPage = 0; - psh.ppsp = psp; - psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE); - - if (LoadString(hApplet, IDS_CPLNAME, szBuffer, sizeof(szBuffer) / sizeof(TCHAR)) < 256) - { - psh.dwFlags |= PSH_PROPTITLE; - psh.pszCaption = szBuffer; - } - - InitPropSheetPage(&psp[0], IDD_USERDSN, UserDSNProc); - InitPropSheetPage(&psp[1], IDD_SYSTEMDSN, SystemDSNProc); - InitPropSheetPage(&psp[2], IDD_FILEDSN, FileDSNProc); - InitPropSheetPage(&psp[3], IDD_DRIVERS, DriversProc); - InitPropSheetPage(&psp[4], IDD_CONNTRACE, TraceProc); - InitPropSheetPage(&psp[5], IDD_CONNPOOL, PoolProc); - InitPropSheetPage(&psp[6], IDD_ABOUT, AboutProc); - return (LONG)(PropertySheet(&psh) != -1); -} +HINSTANCE hApplet = NULL; +APPLET_PROC ODBCProc = NULL; +HMODULE hLibrary = NULL; LONG @@ -70,32 +20,36 @@ LPARAM lParam1, LPARAM lParam2) { - switch(uMsg) + if (ODBCProc == NULL) { - case CPL_INIT: - return TRUE; + TCHAR szBuffer[MAX_PATH]; - case CPL_GETCOUNT: - return 1; + if (ExpandEnvironmentStrings(_T("%systemroot%\\system32\\odbccp32.dll"), + szBuffer, + sizeof(szBuffer) / sizeof(TCHAR)) > 0) + { + hLibrary = LoadLibrary(szBuffer); + if (hLibrary) + { + ODBCProc = (APPLET_PROC)GetProcAddress(hLibrary, "ODBCCPlApplet"); + } + } + } - case CPL_INQUIRE: + if (ODBCProc) + { + return ODBCProc(hwndCpl, uMsg, lParam1, lParam2); + } + else + { + if(hLibrary) { - CPLINFO *CPlInfo = (CPLINFO*)lParam2; - - CPlInfo->lData = lParam1; - CPlInfo->idIcon = CPL_ICON; - CPlInfo->idName = CPL_NAME; - CPlInfo->idInfo = CPL_INFO; - break; + FreeLibrary(hLibrary); } - case CPL_DBLCLK: - { - AppletProc(hwndCpl, uMsg, lParam1, lParam2); - break; - } + TerminateProcess(GetCurrentProcess(), -1); + return (LONG)-1; } - return FALSE; } Modified: trunk/reactos/dll/cpl/odbccp32/odbccp32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/odbccp32/odbccp32.…
============================================================================== --- trunk/reactos/dll/cpl/odbccp32/odbccp32.h (original) +++ trunk/reactos/dll/cpl/odbccp32/odbccp32.h Wed Apr 4 22:43:24 2007 @@ -6,61 +6,7 @@ #include <cpl.h> #include <tchar.h> -#include "resource.h" - extern HINSTANCE hApplet; - -INT_PTR -CALLBACK -UserDSNProc(IN HWND hwndDlg, - IN UINT uMsg, - IN WPARAM wParam, - IN LPARAM lParam); - -INT_PTR -CALLBACK -SystemDSNProc(IN HWND hwndDlg, - IN UINT uMsg, - IN WPARAM wParam, - IN LPARAM lParam); - -INT_PTR -CALLBACK -FileDSNProc(IN HWND hwndDlg, - IN UINT uMsg, - IN WPARAM wParam, - IN LPARAM lParam); - - -INT_PTR -CALLBACK -DriversProc(IN HWND hwndDlg, - IN UINT uMsg, - IN WPARAM wParam, - IN LPARAM lParam); - -INT_PTR -CALLBACK -TraceProc(IN HWND hwndDlg, - IN UINT uMsg, - IN WPARAM wParam, - IN LPARAM lParam); - - -INT_PTR -CALLBACK -PoolProc(IN HWND hwndDlg, - IN UINT uMsg, - IN WPARAM wParam, - IN LPARAM lParam); - -INT_PTR -CALLBACK -AboutProc(IN HWND hwndDlg, - IN UINT uMsg, - IN WPARAM wParam, - IN LPARAM lParam); - - +extern HMODULE hLibrary; #endif /* end of ODBCCP32_H__ */ Modified: trunk/reactos/dll/cpl/odbccp32/odbccp32.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/odbccp32/odbccp32.…
============================================================================== --- trunk/reactos/dll/cpl/odbccp32/odbccp32.rbuild (original) +++ trunk/reactos/dll/cpl/odbccp32/odbccp32.rbuild Wed Apr 4 22:43:24 2007 @@ -12,10 +12,5 @@ <library>comctl32</library> <library>msvcrt</library> <file>odbccp32.c</file> - <file>dsn.c</file> - <file>trace.c</file> - <file>pool.c</file> - <file>about.c</file> - <file>drivers.c</file> <file>odbccp32.rc</file> </module> Modified: trunk/reactos/dll/cpl/odbccp32/odbccp32.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/odbccp32/odbccp32.…
============================================================================== --- trunk/reactos/dll/cpl/odbccp32/odbccp32.rc (original) +++ trunk/reactos/dll/cpl/odbccp32/odbccp32.rc Wed Apr 4 22:43:24 2007 @@ -7,7 +7,3 @@ #define REACTOS_STR_INTERNAL_NAME "odbccp32\0" #define REACTOS_STR_ORIGINAL_FILENAME "odbccp32.cpl\0" #include <reactos/version.rc> - - - -#include "rsrc.rc" Removed: trunk/reactos/dll/cpl/odbccp32/pool.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/odbccp32/pool.c?re…
============================================================================== --- trunk/reactos/dll/cpl/odbccp32/pool.c (original) +++ trunk/reactos/dll/cpl/odbccp32/pool.c (removed) @@ -1,23 +1,0 @@ -/* $Id$ - * - * PROJECT: ReactOS ODBC Control Panel Applet - * FILE: lib/cpl/main/main.c - * PURPOSE: ODBC pool functions - * PROGRAMMER: Johannes Anderwald - */ - -#include "odbccp32.h" - -INT_PTR -CALLBACK -PoolProc(IN HWND hwndDlg, - IN UINT uMsg, - IN WPARAM wParam, - IN LPARAM lParam) -{ - - - - - return FALSE; -} Removed: trunk/reactos/dll/cpl/odbccp32/resource.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/odbccp32/resource.…
============================================================================== --- trunk/reactos/dll/cpl/odbccp32/resource.h (original) +++ trunk/reactos/dll/cpl/odbccp32/resource.h (removed) @@ -1,54 +1,0 @@ -#ifndef RESOURCE_H__ //resource.h -#define RESOURCE_H__ - -// -/// dialog constants -/// -#define IDD_USERDSN 100 -#define IDD_SYSTEMDSN 101 -#define IDD_FILEDSN 102 -#define IDD_DRIVERS 103 -#define IDD_CONNTRACE 104 -#define IDD_CONNPOOL 105 -#define IDD_ABOUT 106 - -#define IDC_CPLICON 150 -#define IDS_CPLNAME 151 -#define CPL_ICON 152 -#define CPL_NAME 153 -#define CPL_INFO 154 - -/// -/// User DSN dialog constants -/// - -#define IDC_USERDSN_ADD 200 -#define IDC_USERDSN_REMOVE 201 -#define IDC_USERDSN_CONFIGURE 202 - -/// -/// System DSN dialog constants -/// - -/// -/// File DSN dialog constants -/// - -/// -/// Drivers dialog constants -/// - -/// -/// Trace dialog constants -/// - -/// -/// Connection pooling dialog constants -/// - -/// -/// About dialog constants -/// - - -#endif /* end of RESOURCE_H__ */ Removed: trunk/reactos/dll/cpl/odbccp32/rsrc.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/odbccp32/rsrc.rc?r…
============================================================================== --- trunk/reactos/dll/cpl/odbccp32/rsrc.rc (original) +++ trunk/reactos/dll/cpl/odbccp32/rsrc.rc (removed) @@ -1,7 +1,0 @@ -#include <windows.h> -#include <commctrl.h> -#include "resource.h" - -LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL - -#include "lang/en-US.rc" Removed: trunk/reactos/dll/cpl/odbccp32/trace.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/odbccp32/trace.c?r…
============================================================================== --- trunk/reactos/dll/cpl/odbccp32/trace.c (original) +++ trunk/reactos/dll/cpl/odbccp32/trace.c (removed) @@ -1,23 +1,0 @@ -/* $Id$ - * - * PROJECT: ReactOS ODBC Control Panel Applet - * FILE: lib/cpl/main/main.c - * PURPOSE: ODBC trace functions - * PROGRAMMER: Johannes Anderwald - */ - -#include "odbccp32.h" - -INT_PTR -CALLBACK -TraceProc(IN HWND hwndDlg, - IN UINT uMsg, - IN WPARAM wParam, - IN LPARAM lParam) -{ - - - - - return FALSE; -}
17 years, 9 months
1
0
0
0
[janderwald] 26262: - beginning of ODBC control panel applet
by janderwald@svn.reactos.org
Author: janderwald Date: Wed Apr 4 20:26:16 2007 New Revision: 26262 URL:
http://svn.reactos.org/svn/reactos?rev=26262&view=rev
Log: - beginning of ODBC control panel applet Added: trunk/reactos/dll/cpl/odbccp32/ (with props) trunk/reactos/dll/cpl/odbccp32/about.c (with props) trunk/reactos/dll/cpl/odbccp32/drivers.c trunk/reactos/dll/cpl/odbccp32/dsn.c (with props) trunk/reactos/dll/cpl/odbccp32/lang/ (with props) trunk/reactos/dll/cpl/odbccp32/lang/en-US.rc (with props) trunk/reactos/dll/cpl/odbccp32/odbccp32.c (with props) trunk/reactos/dll/cpl/odbccp32/odbccp32.def (with props) trunk/reactos/dll/cpl/odbccp32/odbccp32.h (with props) trunk/reactos/dll/cpl/odbccp32/odbccp32.rbuild (with props) trunk/reactos/dll/cpl/odbccp32/odbccp32.rc (with props) trunk/reactos/dll/cpl/odbccp32/pool.c (with props) trunk/reactos/dll/cpl/odbccp32/resource.h (with props) trunk/reactos/dll/cpl/odbccp32/rsrc.rc (with props) trunk/reactos/dll/cpl/odbccp32/trace.c (with props) Propchange: trunk/reactos/dll/cpl/odbccp32/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Wed Apr 4 20:26:16 2007 @@ -1,0 +1,18 @@ +*.coff +*.cpl +*.d +*.a +*.o +*.sym +*.map +*.tmp +*.ncb +*.opt +*.plg +*.~* +dummy*.* +Debug +Release +GNUmakefile +*.vcproj +*.user Added: trunk/reactos/dll/cpl/odbccp32/about.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/odbccp32/about.c?r…
============================================================================== --- trunk/reactos/dll/cpl/odbccp32/about.c (added) +++ trunk/reactos/dll/cpl/odbccp32/about.c Wed Apr 4 20:26:16 2007 @@ -1,0 +1,23 @@ +/* $Id$ + * + * PROJECT: ReactOS ODBC Control Panel Applet + * FILE: lib/cpl/main/main.c + * PURPOSE: ODBC about dialog + * PROGRAMMER: Johannes Anderwald + */ + +#include "odbccp32.h" + +INT_PTR +CALLBACK +AboutProc(IN HWND hwndDlg, + IN UINT uMsg, + IN WPARAM wParam, + IN LPARAM lParam) +{ + + + + + return FALSE; +} Propchange: trunk/reactos/dll/cpl/odbccp32/about.c ------------------------------------------------------------------------------ svn:eol-style = native Propchange: trunk/reactos/dll/cpl/odbccp32/about.c ------------------------------------------------------------------------------ svn:keywords = author date id revision Added: trunk/reactos/dll/cpl/odbccp32/drivers.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/odbccp32/drivers.c…
============================================================================== --- trunk/reactos/dll/cpl/odbccp32/drivers.c (added) +++ trunk/reactos/dll/cpl/odbccp32/drivers.c Wed Apr 4 20:26:16 2007 @@ -1,0 +1,23 @@ +/* $Id: odbccp32.c 22979 2006-07-09 21:10:40Z fireball $ + * + * PROJECT: ReactOS ODBC Control Panel Applet + * FILE: lib/cpl/main/main.c + * PURPOSE: ODBC drivers dialog + * PROGRAMMER: Johannes Anderwald + */ + +#include "odbccp32.h" + +INT_PTR +CALLBACK +DriversProc(IN HWND hwndDlg, + IN UINT uMsg, + IN WPARAM wParam, + IN LPARAM lParam) +{ + + + + + return FALSE; +} Added: trunk/reactos/dll/cpl/odbccp32/dsn.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/odbccp32/dsn.c?rev…
============================================================================== --- trunk/reactos/dll/cpl/odbccp32/dsn.c (added) +++ trunk/reactos/dll/cpl/odbccp32/dsn.c Wed Apr 4 20:26:16 2007 @@ -1,0 +1,51 @@ +/* $Id$ + * + * PROJECT: ReactOS ODBC Control Panel Applet + * FILE: lib/cpl/main/main.c + * PURPOSE: ODBC DSN functions + * PROGRAMMER: Johannes Anderwald + */ + +#include "odbccp32.h" + +INT_PTR +CALLBACK +UserDSNProc(IN HWND hwndDlg, + IN UINT uMsg, + IN WPARAM wParam, + IN LPARAM lParam) +{ + + + + + return FALSE; +} + +INT_PTR +CALLBACK +SystemDSNProc(IN HWND hwndDlg, + IN UINT uMsg, + IN WPARAM wParam, + IN LPARAM lParam) +{ + + + + + return FALSE; +} + +INT_PTR +CALLBACK +FileDSNProc(IN HWND hwndDlg, + IN UINT uMsg, + IN WPARAM wParam, + IN LPARAM lParam) +{ + + + + + return FALSE; +} Propchange: trunk/reactos/dll/cpl/odbccp32/dsn.c ------------------------------------------------------------------------------ svn:eol-style = native Propchange: trunk/reactos/dll/cpl/odbccp32/dsn.c ------------------------------------------------------------------------------ svn:keywords = author date id revision Propchange: trunk/reactos/dll/cpl/odbccp32/lang/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Wed Apr 4 20:26:16 2007 @@ -1,0 +1,18 @@ +*.coff +*.cpl +*.d +*.a +*.o +*.sym +*.map +*.tmp +*.ncb +*.opt +*.plg +*.~* +dummy*.* +Debug +Release +GNUmakefile +*.vcproj +*.user Added: trunk/reactos/dll/cpl/odbccp32/lang/en-US.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/odbccp32/lang/en-U…
============================================================================== --- trunk/reactos/dll/cpl/odbccp32/lang/en-US.rc (added) +++ trunk/reactos/dll/cpl/odbccp32/lang/en-US.rc Wed Apr 4 20:26:16 2007 @@ -1,0 +1,64 @@ +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +IDD_USERDSN DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "User DSN" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "&User Data Sources:", -1, 10, 15, 80, 12 + //FIXME textbox + PUSHBUTTON "A&dd...", IDC_USERDSN_ADD, 185, 30, 50, 12 + PUSHBUTTON "&Remove...", IDC_USERDSN_REMOVE, 185, 45, 50, 12 + PUSHBUTTON "&Configure...", IDC_USERDSN_CONFIGURE, 185, 60, 50, 12 +// ICON -1, -1, 20, 180, 15, 15 + LTEXT "An ODBC User data source stores information about how to connect to the indicated data provider. A User data source is only visible to you and can only be used on the current machine.", -1, 45, 150, 180, 40 +END + +IDD_SYSTEMDSN DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "System DSN" +FONT 8, "MS Shell Dlg" +BEGIN + +END + +IDD_FILEDSN DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "File DSN" +FONT 8, "MS Shell Dlg" +BEGIN + +END + +IDD_DRIVERS DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Drivers" +FONT 8, "MS Shell Dlg" +BEGIN + +END + +IDD_CONNTRACE DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Tracing" +FONT 8, "MS Shell Dlg" +BEGIN + +END + +IDD_CONNPOOL DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Connection Pooling" +FONT 8, "MS Shell Dlg" +BEGIN + +END + +IDD_ABOUT DIALOGEX 0, 0, 246, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "About" +FONT 8, "MS Shell Dlg" +BEGIN + +END + Propchange: trunk/reactos/dll/cpl/odbccp32/lang/en-US.rc ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/dll/cpl/odbccp32/odbccp32.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/odbccp32/odbccp32.…
============================================================================== --- trunk/reactos/dll/cpl/odbccp32/odbccp32.c (added) +++ trunk/reactos/dll/cpl/odbccp32/odbccp32.c Wed Apr 4 20:26:16 2007 @@ -1,0 +1,126 @@ +/* $Id$ + * + * PROJECT: ReactOS ODBC Control Panel Applet + * FILE: lib/cpl/main/main.c + * PURPOSE: applet initialization + * PROGRAMMER: Johannes Anderwald + */ + +#include "odbccp32.h" + +HINSTANCE hApplet = 0; + +VOID +InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc) +{ + ZeroMemory(psp, sizeof(PROPSHEETPAGE)); + + psp->dwSize = sizeof(PROPSHEETPAGE); + psp->dwFlags = PSP_DEFAULT; + psp->hInstance = hApplet; + psp->pszTemplate = MAKEINTRESOURCE(idDlg); + psp->pfnDlgProc = DlgProc; +} + + +LONG +APIENTRY +AppletProc(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam) +{ + PROPSHEETPAGE psp[7]; + PROPSHEETHEADER psh; + TCHAR szBuffer[256]; + + UNREFERENCED_PARAMETER(lParam); + UNREFERENCED_PARAMETER(wParam); + UNREFERENCED_PARAMETER(uMsg); + UNREFERENCED_PARAMETER(hwnd); + + ZeroMemory(&psh, sizeof(PROPSHEETHEADER)); + psh.dwFlags = PSH_PROPSHEETPAGE; + psh.dwSize = sizeof(PROPSHEETHEADER); + psh.hwndParent = NULL; + psh.hInstance = hApplet; + psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON)); + psh.nStartPage = 0; + psh.ppsp = psp; + psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE); + + if (LoadString(hApplet, IDS_CPLNAME, szBuffer, sizeof(szBuffer) / sizeof(TCHAR)) < 256) + { + psh.dwFlags |= PSH_PROPTITLE; + psh.pszCaption = szBuffer; + } + + InitPropSheetPage(&psp[0], IDD_USERDSN, UserDSNProc); + InitPropSheetPage(&psp[1], IDD_SYSTEMDSN, SystemDSNProc); + InitPropSheetPage(&psp[2], IDD_FILEDSN, FileDSNProc); + InitPropSheetPage(&psp[3], IDD_DRIVERS, DriversProc); + InitPropSheetPage(&psp[4], IDD_CONNTRACE, TraceProc); + InitPropSheetPage(&psp[5], IDD_CONNPOOL, PoolProc); + InitPropSheetPage(&psp[6], IDD_ABOUT, AboutProc); + return (LONG)(PropertySheet(&psh) != -1); +} + + +LONG +CALLBACK +CPlApplet(HWND hwndCpl, + UINT uMsg, + LPARAM lParam1, + LPARAM lParam2) +{ + switch(uMsg) + { + case CPL_INIT: + return TRUE; + + case CPL_GETCOUNT: + return 1; + + case CPL_INQUIRE: + { + CPLINFO *CPlInfo = (CPLINFO*)lParam2; + + CPlInfo->lData = lParam1; + CPlInfo->idIcon = CPL_ICON; + CPlInfo->idName = CPL_NAME; + CPlInfo->idInfo = CPL_INFO; + break; + } + + case CPL_DBLCLK: + { + AppletProc(hwndCpl, uMsg, lParam1, lParam2); + break; + } + } + return FALSE; +} + + +BOOL +WINAPI +DllMain(HINSTANCE hinstDLL, + DWORD dwReason, + LPVOID lpReserved) +{ + INITCOMMONCONTROLSEX InitControls; + UNREFERENCED_PARAMETER(lpReserved); + + switch(dwReason) + { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + + InitControls.dwSize = sizeof(INITCOMMONCONTROLSEX); + InitControls.dwICC = ICC_LISTVIEW_CLASSES | ICC_UPDOWN_CLASS | ICC_BAR_CLASSES; + InitCommonControlsEx(&InitControls); + + hApplet = hinstDLL; + break; + } + + return TRUE; +} + Propchange: trunk/reactos/dll/cpl/odbccp32/odbccp32.c ------------------------------------------------------------------------------ svn:eol-style = native Propchange: trunk/reactos/dll/cpl/odbccp32/odbccp32.c ------------------------------------------------------------------------------ svn:keywords = author date id revision Added: trunk/reactos/dll/cpl/odbccp32/odbccp32.def URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/odbccp32/odbccp32.…
============================================================================== --- trunk/reactos/dll/cpl/odbccp32/odbccp32.def (added) +++ trunk/reactos/dll/cpl/odbccp32/odbccp32.def Wed Apr 4 20:26:16 2007 @@ -1,0 +1,6 @@ +LIBRARY odbccp32.cpl + +EXPORTS +CPlApplet + +; EOF Propchange: trunk/reactos/dll/cpl/odbccp32/odbccp32.def ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/dll/cpl/odbccp32/odbccp32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/odbccp32/odbccp32.…
============================================================================== --- trunk/reactos/dll/cpl/odbccp32/odbccp32.h (added) +++ trunk/reactos/dll/cpl/odbccp32/odbccp32.h Wed Apr 4 20:26:16 2007 @@ -1,0 +1,66 @@ +#ifndef ODBCCP32_H__ // odbccp32.h +#define ODBCCP32_H__ + +#include <windows.h> +#include <commctrl.h> +#include <cpl.h> +#include <tchar.h> + +#include "resource.h" + +extern HINSTANCE hApplet; + +INT_PTR +CALLBACK +UserDSNProc(IN HWND hwndDlg, + IN UINT uMsg, + IN WPARAM wParam, + IN LPARAM lParam); + +INT_PTR +CALLBACK +SystemDSNProc(IN HWND hwndDlg, + IN UINT uMsg, + IN WPARAM wParam, + IN LPARAM lParam); + +INT_PTR +CALLBACK +FileDSNProc(IN HWND hwndDlg, + IN UINT uMsg, + IN WPARAM wParam, + IN LPARAM lParam); + + +INT_PTR +CALLBACK +DriversProc(IN HWND hwndDlg, + IN UINT uMsg, + IN WPARAM wParam, + IN LPARAM lParam); + +INT_PTR +CALLBACK +TraceProc(IN HWND hwndDlg, + IN UINT uMsg, + IN WPARAM wParam, + IN LPARAM lParam); + + +INT_PTR +CALLBACK +PoolProc(IN HWND hwndDlg, + IN UINT uMsg, + IN WPARAM wParam, + IN LPARAM lParam); + +INT_PTR +CALLBACK +AboutProc(IN HWND hwndDlg, + IN UINT uMsg, + IN WPARAM wParam, + IN LPARAM lParam); + + + +#endif /* end of ODBCCP32_H__ */ Propchange: trunk/reactos/dll/cpl/odbccp32/odbccp32.h ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/dll/cpl/odbccp32/odbccp32.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/odbccp32/odbccp32.…
============================================================================== --- trunk/reactos/dll/cpl/odbccp32/odbccp32.rbuild (added) +++ trunk/reactos/dll/cpl/odbccp32/odbccp32.rbuild Wed Apr 4 20:26:16 2007 @@ -1,0 +1,21 @@ +<module name="odbccp32i" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_ODBCCP32}" installbase="system32" installname="odbccp32.cpl" usewrc="false"> + <importlibrary definition="odbccp32.def" /> + <include base="odbccp32">.</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> + <library>kernel32</library> + <library>user32</library> + <library>comctl32</library> + <library>msvcrt</library> + <file>odbccp32.c</file> + <file>dsn.c</file> + <file>trace.c</file> + <file>pool.c</file> + <file>about.c</file> + <file>drivers.c</file> + <file>odbccp32.rc</file> +</module> Propchange: trunk/reactos/dll/cpl/odbccp32/odbccp32.rbuild ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/dll/cpl/odbccp32/odbccp32.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/odbccp32/odbccp32.…
============================================================================== --- trunk/reactos/dll/cpl/odbccp32/odbccp32.rc (added) +++ trunk/reactos/dll/cpl/odbccp32/odbccp32.rc Wed Apr 4 20:26:16 2007 @@ -1,0 +1,13 @@ + +#include <windows.h> +#include "resource.h" + +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS ODBC Control Panel Applet\0" +#define REACTOS_STR_INTERNAL_NAME "odbccp32\0" +#define REACTOS_STR_ORIGINAL_FILENAME "odbccp32.cpl\0" +#include <reactos/version.rc> + + + +#include "rsrc.rc" Propchange: trunk/reactos/dll/cpl/odbccp32/odbccp32.rc ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/dll/cpl/odbccp32/pool.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/odbccp32/pool.c?re…
============================================================================== --- trunk/reactos/dll/cpl/odbccp32/pool.c (added) +++ trunk/reactos/dll/cpl/odbccp32/pool.c Wed Apr 4 20:26:16 2007 @@ -1,0 +1,23 @@ +/* $Id$ + * + * PROJECT: ReactOS ODBC Control Panel Applet + * FILE: lib/cpl/main/main.c + * PURPOSE: ODBC pool functions + * PROGRAMMER: Johannes Anderwald + */ + +#include "odbccp32.h" + +INT_PTR +CALLBACK +PoolProc(IN HWND hwndDlg, + IN UINT uMsg, + IN WPARAM wParam, + IN LPARAM lParam) +{ + + + + + return FALSE; +} Propchange: trunk/reactos/dll/cpl/odbccp32/pool.c ------------------------------------------------------------------------------ svn:eol-style = native Propchange: trunk/reactos/dll/cpl/odbccp32/pool.c ------------------------------------------------------------------------------ svn:keywords = author date id revision Added: trunk/reactos/dll/cpl/odbccp32/resource.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/odbccp32/resource.…
============================================================================== --- trunk/reactos/dll/cpl/odbccp32/resource.h (added) +++ trunk/reactos/dll/cpl/odbccp32/resource.h Wed Apr 4 20:26:16 2007 @@ -1,0 +1,54 @@ +#ifndef RESOURCE_H__ //resource.h +#define RESOURCE_H__ + +// +/// dialog constants +/// +#define IDD_USERDSN 100 +#define IDD_SYSTEMDSN 101 +#define IDD_FILEDSN 102 +#define IDD_DRIVERS 103 +#define IDD_CONNTRACE 104 +#define IDD_CONNPOOL 105 +#define IDD_ABOUT 106 + +#define IDC_CPLICON 150 +#define IDS_CPLNAME 151 +#define CPL_ICON 152 +#define CPL_NAME 153 +#define CPL_INFO 154 + +/// +/// User DSN dialog constants +/// + +#define IDC_USERDSN_ADD 200 +#define IDC_USERDSN_REMOVE 201 +#define IDC_USERDSN_CONFIGURE 202 + +/// +/// System DSN dialog constants +/// + +/// +/// File DSN dialog constants +/// + +/// +/// Drivers dialog constants +/// + +/// +/// Trace dialog constants +/// + +/// +/// Connection pooling dialog constants +/// + +/// +/// About dialog constants +/// + + +#endif /* end of RESOURCE_H__ */ Propchange: trunk/reactos/dll/cpl/odbccp32/resource.h ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/dll/cpl/odbccp32/rsrc.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/odbccp32/rsrc.rc?r…
============================================================================== --- trunk/reactos/dll/cpl/odbccp32/rsrc.rc (added) +++ trunk/reactos/dll/cpl/odbccp32/rsrc.rc Wed Apr 4 20:26:16 2007 @@ -1,0 +1,7 @@ +#include <windows.h> +#include <commctrl.h> +#include "resource.h" + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL + +#include "lang/en-US.rc" Propchange: trunk/reactos/dll/cpl/odbccp32/rsrc.rc ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/dll/cpl/odbccp32/trace.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/odbccp32/trace.c?r…
============================================================================== --- trunk/reactos/dll/cpl/odbccp32/trace.c (added) +++ trunk/reactos/dll/cpl/odbccp32/trace.c Wed Apr 4 20:26:16 2007 @@ -1,0 +1,23 @@ +/* $Id$ + * + * PROJECT: ReactOS ODBC Control Panel Applet + * FILE: lib/cpl/main/main.c + * PURPOSE: ODBC trace functions + * PROGRAMMER: Johannes Anderwald + */ + +#include "odbccp32.h" + +INT_PTR +CALLBACK +TraceProc(IN HWND hwndDlg, + IN UINT uMsg, + IN WPARAM wParam, + IN LPARAM lParam) +{ + + + + + return FALSE; +} Propchange: trunk/reactos/dll/cpl/odbccp32/trace.c ------------------------------------------------------------------------------ svn:eol-style = native Propchange: trunk/reactos/dll/cpl/odbccp32/trace.c ------------------------------------------------------------------------------ svn:keywords = author date id revision
17 years, 9 months
1
0
0
0
[fireball] 26261: - Fix freeing of an unallocated memory bug (RtlInitUnicodeString() never allocates anything, it just initializes necessary fields, and noone asks us to free the string the function gets as a parameter).
by fireball@svn.reactos.org
Author: fireball Date: Wed Apr 4 20:04:41 2007 New Revision: 26261 URL:
http://svn.reactos.org/svn/reactos?rev=26261&view=rev
Log: - Fix freeing of an unallocated memory bug (RtlInitUnicodeString() never allocates anything, it just initializes necessary fields, and noone asks us to free the string the function gets as a parameter). Modified: trunk/reactos/dll/win32/user32/windows/clipboard.c Modified: trunk/reactos/dll/win32/user32/windows/clipboard.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/c…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/clipboard.c (original) +++ trunk/reactos/dll/win32/user32/windows/clipboard.c Wed Apr 4 20:04:41 2007 @@ -269,8 +269,7 @@ RtlInitUnicodeString(&usFormat, lpszFormat); ret = NtUserRegisterClipboardFormat(&usFormat); - RtlFreeUnicodeString(&usFormat); - + return ret; }
17 years, 9 months
1
0
0
0
[fireball] 26260: ... and pciide/pciidex.
by fireball@svn.reactos.org
Author: fireball Date: Wed Apr 4 19:22:03 2007 New Revision: 26260 URL:
http://svn.reactos.org/svn/reactos?rev=26260&view=rev
Log: ... and pciide/pciidex. Modified: trunk/reactos/boot/bootdata/packages/reactos.dff Modified: trunk/reactos/boot/bootdata/packages/reactos.dff URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/packages/rea…
============================================================================== --- trunk/reactos/boot/bootdata/packages/reactos.dff (original) +++ trunk/reactos/boot/bootdata/packages/reactos.dff Wed Apr 4 19:22:03 2007 @@ -255,8 +255,8 @@ drivers\network\dd\ne2000\ne2000.sys 2 drivers\network\dd\pcnet\pcnet.sys 2 -drivers\storage\pciide\pciide.sys 2 -drivers\storage\pciidex\pciidex.sys 2 +drivers\storage\ide\pciide\pciide.sys 2 +drivers\storage\ide\pciidex\pciidex.sys 2 ;drivers\usb\miniport\usbohci\usbohci.sys 2 ;drivers\usb\miniport\usbuhci\usbuhci.sys 2
17 years, 9 months
1
0
0
0
[fireball] 26259: - Fix up npfs/msfs drivers paths.
by fireball@svn.reactos.org
Author: fireball Date: Wed Apr 4 19:15:43 2007 New Revision: 26259 URL:
http://svn.reactos.org/svn/reactos?rev=26259&view=rev
Log: - Fix up npfs/msfs drivers paths. Modified: trunk/reactos/boot/bootdata/packages/reactos.dff Modified: trunk/reactos/boot/bootdata/packages/reactos.dff URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/packages/rea…
============================================================================== --- trunk/reactos/boot/bootdata/packages/reactos.dff (original) +++ trunk/reactos/boot/bootdata/packages/reactos.dff Wed Apr 4 19:15:43 2007 @@ -240,9 +240,9 @@ drivers\bus\serenum\serenum.sys 2 drivers\filesystems\fs_rec\fs_rec.sys 2 -drivers\filesystems\ms\msfs.sys 2 +drivers\filesystems\msfs\msfs.sys 2 drivers\filesystems\mup\mup.sys 2 -drivers\filesystems\np\npfs.sys 2 +drivers\filesystems\npfs\npfs.sys 2 drivers\input\mouclass\mouclass.sys 2 drivers\input\sermouse\sermouse.sys 2
17 years, 9 months
1
0
0
0
[ion] 26258: - Refactor device attachment into a private routine. - We shouldn't allow attaching to a device that's still initlizaing, but ROS currently does because of some device that tries to do this, in the PnP manager or early boot-phase drivers (it has an auto-generated name). Please fix this!
by ion@svn.reactos.org
Author: ion Date: Wed Apr 4 07:19:27 2007 New Revision: 26258 URL:
http://svn.reactos.org/svn/reactos?rev=26258&view=rev
Log: - Refactor device attachment into a private routine. - We shouldn't allow attaching to a device that's still initlizaing, but ROS currently does because of some device that tries to do this, in the PnP manager or early boot-phase drivers (it has an auto-generated name). Please fix this! Modified: trunk/reactos/ntoskrnl/io/iomgr/device.c Modified: trunk/reactos/ntoskrnl/io/iomgr/device.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/device.c…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/device.c (original) +++ trunk/reactos/ntoskrnl/io/iomgr/device.c Wed Apr 4 07:19:27 2007 @@ -37,9 +37,18 @@ SourceDeviceExtension = IoGetDevObjExtension(SourceDevice); ASSERT(SourceDeviceExtension->AttachedTo == NULL); + /* FIXME: ROS HACK */ + if (AttachedDevice->Flags & DO_DEVICE_INITIALIZING) + { + DPRINT1("Io: CRITICAL: Allowing attach to device which hasn't " + "cleared its DO_DEVICE_INITIALIZING flag. Fix the damn " + "thing: %p %wZ\n", + AttachedDevice, + &AttachedDevice->DriverObject->DriverName); + } + /* Make sure that it's in a correct state */ - if ((AttachedDevice->Flags & DO_DEVICE_INITIALIZING) || - (IoGetDevObjExtension(AttachedDevice)->ExtensionFlags & + if ((IoGetDevObjExtension(AttachedDevice)->ExtensionFlags & (DOE_UNLOAD_PENDING | DOE_DELETE_PENDING | DOE_REMOVE_PENDING | @@ -629,16 +638,10 @@ IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice) { - NTSTATUS Status; - PDEVICE_OBJECT LocalAttach; - /* Attach it safely */ - Status = IoAttachDeviceToDeviceStackSafe(SourceDevice, - TargetDevice, - &LocalAttach); - - /* Return it */ - return LocalAttach; + return IopAttachDeviceToDeviceStackSafe(SourceDevice, + TargetDevice, + NULL); } /* @@ -650,41 +653,16 @@ IN PDEVICE_OBJECT TargetDevice, IN OUT PDEVICE_OBJECT *AttachedToDeviceObject) { - PDEVICE_OBJECT AttachedDevice; - PEXTENDED_DEVOBJ_EXTENSION SourceDeviceExtension; - - /* Get the Attached Device and source extension */ - AttachedDevice = IoGetAttachedDevice(TargetDevice); - SourceDeviceExtension = IoGetDevObjExtension(SourceDevice); - - /* Make sure that it's in a correct state */ - if (!IoGetDevObjExtension(AttachedDevice)->ExtensionFlags & - (DOE_UNLOAD_PENDING | - DOE_DELETE_PENDING | - DOE_REMOVE_PENDING | - DOE_REMOVE_PROCESSED)) - { - /* Update atached device fields */ - AttachedDevice->AttachedDevice = SourceDevice; - AttachedDevice->Spare1++; - - /* Update the source with the attached data */ - SourceDevice->StackSize = AttachedDevice->StackSize + 1; - SourceDevice->AlignmentRequirement = AttachedDevice-> - AlignmentRequirement; - SourceDevice->SectorSize = AttachedDevice->SectorSize; - - /* Set the attachment in the device extension */ - SourceDeviceExtension->AttachedTo = AttachedDevice; - } - else - { - /* Device was unloading or being removed */ - AttachedDevice = NULL; - } - - /* Return the attached device */ - *AttachedToDeviceObject = AttachedDevice; + /* Call the internal function */ + if (!IopAttachDeviceToDeviceStackSafe(SourceDevice, + TargetDevice, + AttachedToDeviceObject)) + { + /* Nothing found */ + return STATUS_NO_SUCH_DEVICE; + } + + /* Success! */ return STATUS_SUCCESS; }
17 years, 9 months
1
0
0
0
[ion] 26257: - Implement IopAttachDeviceToDeviceStackSafe for future use. - Use OBJ_KERNEL_HANDLE for various internal Device Object handles. - Fix bug in IopStartNextPacketByKeyEx which didn't actually read the flags to see if the I/O was cancelleable or not. - Fail DO creation if the VPB couldn't be created. - Fix completely wrong implementation of IoGetDeviceAttachmentBaseRef. It was getting the attached device instead of the base device, and wasn't even referencing it!. -
by ion@svn.reactos.org
Author: ion Date: Wed Apr 4 06:49:41 2007 New Revision: 26257 URL:
http://svn.reactos.org/svn/reactos?rev=26257&view=rev
Log: - Implement IopAttachDeviceToDeviceStackSafe for future use. - Use OBJ_KERNEL_HANDLE for various internal Device Object handles. - Fix bug in IopStartNextPacketByKeyEx which didn't actually read the flags to see if the I/O was cancelleable or not. - Fail DO creation if the VPB couldn't be created. - Fix completely wrong implementation of IoGetDeviceAttachmentBaseRef. It was getting the attached device instead of the base device, and wasn't even referencing it!. - Modified: trunk/reactos/ntoskrnl/io/iomgr/device.c Modified: trunk/reactos/ntoskrnl/io/iomgr/device.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/device.c…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/device.c (original) +++ trunk/reactos/ntoskrnl/io/iomgr/device.c Wed Apr 4 06:49:41 2007 @@ -22,6 +22,61 @@ KSPIN_LOCK ShutdownListLock; /* PRIVATE FUNCTIONS **********************************************************/ + +PDEVICE_OBJECT +NTAPI +IopAttachDeviceToDeviceStackSafe(IN PDEVICE_OBJECT SourceDevice, + IN PDEVICE_OBJECT TargetDevice, + OUT PDEVICE_OBJECT *AttachedToDeviceObject OPTIONAL) +{ + PDEVICE_OBJECT AttachedDevice; + PEXTENDED_DEVOBJ_EXTENSION SourceDeviceExtension; + + /* Get the Attached Device and source extension */ + AttachedDevice = IoGetAttachedDevice(TargetDevice); + SourceDeviceExtension = IoGetDevObjExtension(SourceDevice); + ASSERT(SourceDeviceExtension->AttachedTo == NULL); + + /* Make sure that it's in a correct state */ + if ((AttachedDevice->Flags & DO_DEVICE_INITIALIZING) || + (IoGetDevObjExtension(AttachedDevice)->ExtensionFlags & + (DOE_UNLOAD_PENDING | + DOE_DELETE_PENDING | + DOE_REMOVE_PENDING | + DOE_REMOVE_PROCESSED))) + { + /* Device was unloading or being removed */ + AttachedDevice = NULL; + } + else + { + /* Update atached device fields */ + AttachedDevice->AttachedDevice = SourceDevice; + AttachedDevice->Spare1++; + + /* Update the source with the attached data */ + SourceDevice->StackSize = AttachedDevice->StackSize + 1; + SourceDevice->AlignmentRequirement = AttachedDevice-> + AlignmentRequirement; + SourceDevice->SectorSize = AttachedDevice->SectorSize; + + /* Check for pending start flag */ + if (IoGetDevObjExtension(AttachedDevice)->ExtensionFlags & + DOE_START_PENDING) + { + /* Propagate */ + IoGetDevObjExtension(SourceDevice)->ExtensionFlags |= + DOE_START_PENDING; + } + + /* Set the attachment in the device extension */ + SourceDeviceExtension->AttachedTo = AttachedDevice; + } + + /* Return the attached device */ + if (AttachedToDeviceObject) *AttachedToDeviceObject = AttachedDevice; + return AttachedDevice; +} VOID NTAPI @@ -93,7 +148,7 @@ /* Open the Device */ InitializeObjectAttributes(&ObjectAttributes, ObjectName, - 0, + OBJ_KERNEL_HANDLE, NULL, NULL); Status = ZwOpenFile(&FileHandle, @@ -463,14 +518,16 @@ { /* Start the packet with a key */ IopStartNextPacketByKey(DeviceObject, - (DOE_SIO_CANCELABLE) ? TRUE : FALSE, + (Flags & DOE_SIO_CANCELABLE) ? + TRUE : FALSE, CurrentKey); } else if (Flags & DOE_SIO_NO_KEY) { /* Start the packet */ IopStartNextPacket(DeviceObject, - (DOE_SIO_CANCELABLE) ? TRUE : FALSE); + (Flags & DOE_SIO_CANCELABLE) ? + TRUE : FALSE); } } @@ -536,7 +593,6 @@ Status = IoAttachDeviceToDeviceStackSafe(SourceDevice, TargetDevice, AttachedDevice); - if (!*AttachedDevice) Status = STATUS_NO_SUCH_DEVICE; /* Dereference it */ ObDereferenceObject(FileObject); @@ -566,15 +622,12 @@ } /* - * IoAttachDeviceToDeviceStack - * - * Status - * @implemented + * @implemented */ PDEVICE_OBJECT NTAPI -IoAttachDeviceToDeviceStack(PDEVICE_OBJECT SourceDevice, - PDEVICE_OBJECT TargetDevice) +IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, + IN PDEVICE_OBJECT TargetDevice) { NTSTATUS Status; PDEVICE_OBJECT LocalAttach; @@ -595,7 +648,7 @@ NTAPI IoAttachDeviceToDeviceStackSafe(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice, - OUT PDEVICE_OBJECT *AttachedToDeviceObject) + IN OUT PDEVICE_OBJECT *AttachedToDeviceObject) { PDEVICE_OBJECT AttachedDevice; PEXTENDED_DEVOBJ_EXTENSION SourceDeviceExtension; @@ -702,7 +755,11 @@ } /* Initialize the Object Attributes */ - InitializeObjectAttributes(&ObjectAttributes, DeviceName, 0, NULL, NULL); + InitializeObjectAttributes(&ObjectAttributes, + DeviceName, + OBJ_KERNEL_HANDLE, + NULL, + NULL); /* Honor exclusive flag */ if (Exclusive) ObjectAttributes.Attributes |= OBJ_EXCLUSIVE; @@ -769,13 +826,19 @@ if (DeviceName) CreatedDeviceObject->Flags |= DO_DEVICE_HAS_NAME; /* Attach a Vpb for Disks and Tapes, and create the Device Lock */ - if (CreatedDeviceObject->DeviceType == FILE_DEVICE_DISK || - CreatedDeviceObject->DeviceType == FILE_DEVICE_VIRTUAL_DISK || - CreatedDeviceObject->DeviceType == FILE_DEVICE_CD_ROM || - CreatedDeviceObject->DeviceType == FILE_DEVICE_TAPE) + if ((CreatedDeviceObject->DeviceType == FILE_DEVICE_DISK) || + (CreatedDeviceObject->DeviceType == FILE_DEVICE_VIRTUAL_DISK) || + (CreatedDeviceObject->DeviceType == FILE_DEVICE_CD_ROM) || + (CreatedDeviceObject->DeviceType == FILE_DEVICE_TAPE)) { /* Create Vpb */ - IopCreateVpb(CreatedDeviceObject); + Status = IopCreateVpb(CreatedDeviceObject); + if (!NT_SUCCESS(Status)) + { + /* Reference the device object and fail */ + ObDereferenceObject(DeviceObject); + return Status; + } /* Initialize Lock Event */ KeInitializeEvent(&CreatedDeviceObject->DeviceLock, @@ -803,11 +866,11 @@ } /* Create the Device Queue */ - if (CreatedDeviceObject->DeviceType == FILE_DEVICE_DISK_FILE_SYSTEM || - CreatedDeviceObject->DeviceType == FILE_DEVICE_FILE_SYSTEM || - CreatedDeviceObject->DeviceType == FILE_DEVICE_CD_ROM_FILE_SYSTEM || - CreatedDeviceObject->DeviceType == FILE_DEVICE_NETWORK_FILE_SYSTEM || - CreatedDeviceObject->DeviceType == FILE_DEVICE_TAPE_FILE_SYSTEM) + if ((CreatedDeviceObject->DeviceType == FILE_DEVICE_DISK_FILE_SYSTEM) || + (CreatedDeviceObject->DeviceType == FILE_DEVICE_FILE_SYSTEM) || + (CreatedDeviceObject->DeviceType == FILE_DEVICE_CD_ROM_FILE_SYSTEM) || + (CreatedDeviceObject->DeviceType == FILE_DEVICE_NETWORK_FILE_SYSTEM) || + (CreatedDeviceObject->DeviceType == FILE_DEVICE_TAPE_FILE_SYSTEM)) { /* Simple FS Devices, they don't need a real Device Queue */ InitializeListHead(&CreatedDeviceObject->Queue.ListEntry); @@ -825,20 +888,16 @@ 1, (PVOID*)&CreatedDeviceObject, &TempHandle); - if (!NT_SUCCESS(Status)) - { - /* Clear the device object and fail */ - *DeviceObject = NULL; - return Status; - } + if (!NT_SUCCESS(Status)) return Status; /* Now do the final linking */ ObReferenceObject(DriverObject); + ASSERT((DriverObject->Flags & DRVO_UNLOAD_INVOKED) == 0); CreatedDeviceObject->DriverObject = DriverObject; IopEditDeviceList(DriverObject, CreatedDeviceObject, IopAdd); /* Close the temporary handle and return to caller */ - NtClose(TempHandle); + ObCloseHandle(TempHandle, KernelMode); *DeviceObject = CreatedDeviceObject; return STATUS_SUCCESS; } @@ -1011,8 +1070,10 @@ NTAPI IoGetDeviceAttachmentBaseRef(IN PDEVICE_OBJECT DeviceObject) { - /* Return the attached Device */ - return IoGetDevObjExtension(DeviceObject)->AttachedTo; + /* Reference the lowest attached device */ + DeviceObject = IopGetLowestDevice(DeviceObject); + ObReferenceObject(DeviceObject); + return DeviceObject; } /* @@ -1119,13 +1180,7 @@ } /* - * IoGetRelatedDeviceObject - * - * Remarks - * See "Windows NT File System Internals", page 633 - 634. - * - * Status - * @implemented + * @implemented */ PDEVICE_OBJECT NTAPI
17 years, 9 months
1
0
0
0
[ion] 26256: - Remove "zero-stream" from null, NT doesn't support this. - Implement Fast I/O Dispatch entrypoints for null. - Support query file information and lock IRPs, just like NT. - Remove query volume information IRP, not supported by NT. - Page the entire driver.
by ion@svn.reactos.org
Author: ion Date: Tue Apr 3 20:22:44 2007 New Revision: 26256 URL:
http://svn.reactos.org/svn/reactos?rev=26256&view=rev
Log: - Remove "zero-stream" from null, NT doesn't support this. - Implement Fast I/O Dispatch entrypoints for null. - Support query file information and lock IRPs, just like NT. - Remove query volume information IRP, not supported by NT. - Page the entire driver. Removed: trunk/reactos/drivers/base/null/null.h Modified: trunk/reactos/drivers/base/null/null.c Modified: trunk/reactos/drivers/base/null/null.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/null/null.c?r…
============================================================================== --- trunk/reactos/drivers/base/null/null.c (original) +++ trunk/reactos/drivers/base/null/null.c Tue Apr 3 20:22:44 2007 @@ -1,205 +1,207 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: services/null/null.c - * PURPOSE: NULL device driver - * PROGRAMMER: David Welch (welch(a)mcmail.com) - * UPDATE HISTORY: - * 13/08/1998: Created - * 29/04/2002: Fixed bugs, added zero-stream device - * 28/06/2004: Compile against the DDK, use PSEH where necessary +/* + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory + * FILE: drivers/base/null/null.c + * PURPOSE: Beep Device Driver + * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org) + * David Welch (welch(a)mcmail.com) */ -/* INCLUDES */ +/* INCLUDES ******************************************************************/ + #include <ntddk.h> -#include <pseh/pseh.h> - -#include "null.h" - -/* OBJECTS */ -static const NULL_EXTENSION nxNull = NullBitBucket; -static const NULL_EXTENSION nxZero = NullZeroStream; - -/* FUNCTIONS */ -static NTSTATUS STDCALL -NullDispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp) -{ - PIO_STACK_LOCATION piosStack = IoGetCurrentIrpStackLocation(Irp); - NTSTATUS nErrCode; - - nErrCode = STATUS_SUCCESS; - Irp->IoStatus.Information = 0; - - switch(piosStack->MajorFunction) +/* FUNCTIONS *****************************************************************/ + +NTSTATUS +NTAPI +NullQueryFileInformation(OUT PVOID Buffer, + IN PULONG Length, + IN FILE_INFORMATION_CLASS InformationClass) +{ + PFILE_STANDARD_INFORMATION StandardInfo = Buffer; + PAGED_CODE(); + + /* We only support one class */ + if (InformationClass != FileStandardInformation) { - /* opening and closing handles to the device */ + /* Fail */ + return STATUS_INVALID_INFO_CLASS; + } + + /* Fill out the information */ + RtlZeroMemory(StandardInfo, sizeof(FILE_STANDARD_INFORMATION)); + StandardInfo->NumberOfLinks = 1; + + /* Return the length and success */ + *Length = sizeof(FILE_STANDARD_INFORMATION); + return STATUS_SUCCESS; +} + +BOOLEAN +NTAPI +NullRead(IN PFILE_OBJECT FileObject, + IN PLARGE_INTEGER FileOffset, + IN ULONG Length, + IN BOOLEAN Wait, + IN ULONG LockKey, + OUT PVOID Buffer, + OUT PIO_STATUS_BLOCK IoStatus, + IN PDEVICE_OBJECT DeviceObject) +{ + PAGED_CODE(); + + /* Complete successfully */ + IoStatus->Status = STATUS_END_OF_FILE; + IoStatus->Information = 0; + return TRUE; +} + +BOOLEAN +NTAPI +NullWrite(IN PFILE_OBJECT FileObject, + IN PLARGE_INTEGER FileOffset, + IN ULONG Length, + IN BOOLEAN Wait, + IN ULONG LockKey, + IN PVOID Buffer, + OUT PIO_STATUS_BLOCK IoStatus, + IN PDEVICE_OBJECT DeviceObject) +{ + PAGED_CODE(); + + /* Complete successfully */ + IoStatus->Status = STATUS_SUCCESS; + IoStatus->Information = Length; + return TRUE; +} + +NTSTATUS +STDCALL +NullDispatch(IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + PIO_STACK_LOCATION IoStack = IoGetCurrentIrpStackLocation(Irp); + NTSTATUS Status; + PFILE_OBJECT FileObject; + ULONG Length; + PAGED_CODE(); + + /* Get the file object and check what kind of request this is */ + FileObject = IoStack->FileObject; + switch (IoStack->MajorFunction) + { case IRP_MJ_CREATE: case IRP_MJ_CLOSE: - switch(NULL_DEVICE_TYPE(DeviceObject)) + + /* Check if this is synch I/O */ + if (FileObject->Flags & FO_SYNCHRONOUS_IO) { - case NullBitBucket: - case NullZeroStream: - break; - - default: - ASSERT(FALSE); + /* Set distinguished value for Cc */ + FileObject->PrivateCacheMap = (PVOID)1; } - break; - - /* write data */ + /* Complete successfully */ + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = 0; + break; + + case IRP_MJ_READ: + + /* Return as if we read the entire file */ + Irp->IoStatus.Status = STATUS_END_OF_FILE; + Irp->IoStatus.Information = 0; + break; + case IRP_MJ_WRITE: - { - switch(NULL_DEVICE_TYPE(DeviceObject)) - { - case NullBitBucket: - Irp->IoStatus.Information = piosStack->Parameters.Write.Length; - break; - - case NullZeroStream: - nErrCode = STATUS_INVALID_DEVICE_REQUEST; - break; - - default: - ASSERT(FALSE); - } - - break; - } - - /* read data */ - case IRP_MJ_READ: - { - switch(NULL_DEVICE_TYPE(DeviceObject)) - { - case NullBitBucket: - nErrCode = STATUS_END_OF_FILE; - break; - - case NullZeroStream: - _SEH_TRY - { - RtlZeroMemory(Irp->AssociatedIrp.SystemBuffer, piosStack->Parameters.Read.Length); - Irp->IoStatus.Information = piosStack->Parameters.Read.Length; - } - _SEH_HANDLE - { - nErrCode = _SEH_GetExceptionCode(); - } - _SEH_END; - - break; - - default: - ASSERT(FALSE); - - } - - break; - } - - case IRP_MJ_QUERY_VOLUME_INFORMATION: - switch(piosStack->Parameters.QueryVolume.FsInformationClass) - { - case FileFsDeviceInformation: - { - ULONG BufferLength = piosStack->Parameters.QueryVolume.Length; - PFILE_FS_DEVICE_INFORMATION FsDeviceInfo = (PFILE_FS_DEVICE_INFORMATION)Irp->AssociatedIrp.SystemBuffer; - - if (BufferLength >= sizeof(FILE_FS_DEVICE_INFORMATION)) - { - FsDeviceInfo->DeviceType = FILE_DEVICE_NULL; - FsDeviceInfo->Characteristics = 0; /* FIXME: fix this !! */ - Irp->IoStatus.Information = sizeof(FILE_FS_DEVICE_INFORMATION); - nErrCode = STATUS_SUCCESS; - } - else - { - Irp->IoStatus.Information = 0; - nErrCode = STATUS_BUFFER_OVERFLOW; - } - } - break; - - default: - Irp->IoStatus.Information = 0; - nErrCode = STATUS_NOT_IMPLEMENTED; - } - break; - - default: + + /* Return as if we wrote the entire request */ + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = IoStack->Parameters.Write.Length; + break; + + case IRP_MJ_LOCK_CONTROL: + + /* Dummy */ + Irp->IoStatus.Status = STATUS_SUCCESS; Irp->IoStatus.Information = 0; - nErrCode = STATUS_NOT_IMPLEMENTED; - + break; + + case IRP_MJ_QUERY_INFORMATION: + + /* Get the length inputted and do the request */ + Length = IoStack->Parameters.QueryFile.Length; + Irp->IoStatus.Status = NullQueryFileInformation(Irp->AssociatedIrp. + SystemBuffer, + &Length, + IoStack-> + Parameters. + QueryFile. + FileInformationClass); + + /* Return the actual length */ + Irp->IoStatus.Information = Length; + break; } - Irp->IoStatus.Status = nErrCode; + /* Complete the request */ + Status = Irp->IoStatus.Status; IoCompleteRequest(Irp, IO_NO_INCREMENT); - - return (nErrCode); -} - -static VOID STDCALL -NullUnload(PDRIVER_OBJECT DriverObject) -{ -} - -/* TODO: \Device\Zero should be memory-mappable */ -NTSTATUS STDCALL -DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath) -{ - PDEVICE_OBJECT pdoNullDevice; - PDEVICE_OBJECT pdoZeroDevice; - UNICODE_STRING wstrNullDeviceName = RTL_CONSTANT_STRING(L"\\Device\\Null"); - UNICODE_STRING wstrZeroDeviceName = RTL_CONSTANT_STRING(L"\\Device\\Zero"); - NTSTATUS nErrCode; - - /* register driver routines */ + return Status; +} + +NTSTATUS +STDCALL +DriverEntry(IN PDRIVER_OBJECT DriverObject, + IN PUNICODE_STRING RegistryPath) +{ + PDEVICE_OBJECT DeviceObject; + UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\Null"); + NTSTATUS Status; + PFAST_IO_DISPATCH FastIoDispatch; + PAGED_CODE(); + + /* Page the driver */ + MmPageEntireDriver(DriverEntry); + + /* Create null device */ + Status = IoCreateDevice(DriverObject, + 0, + &DeviceName, + FILE_DEVICE_NULL, + 0, + FALSE, + &DeviceObject); + if (!NT_SUCCESS(Status)) return Status; + + /* Register driver routines */ DriverObject->MajorFunction[IRP_MJ_CLOSE] = NullDispatch; DriverObject->MajorFunction[IRP_MJ_CREATE] = NullDispatch; DriverObject->MajorFunction[IRP_MJ_WRITE] = NullDispatch; DriverObject->MajorFunction[IRP_MJ_READ] = NullDispatch; - DriverObject->DriverUnload = NullUnload; - - /* create null device */ - nErrCode = IoCreateDevice(DriverObject, - sizeof(NULL_EXTENSION), - &wstrNullDeviceName, - FILE_DEVICE_NULL, - 0, - FALSE, - &pdoNullDevice); - - /* failure */ - if(!NT_SUCCESS(nErrCode)) + DriverObject->MajorFunction[IRP_MJ_LOCK_CONTROL] = NullDispatch; + DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] = NullDispatch; + + /* Allocate the fast I/O dispatch table */ + FastIoDispatch = ExAllocatePool(NonPagedPool, sizeof(FAST_IO_DISPATCH)); + if (!FastIoDispatch) { - return (nErrCode); + /* Failed, cleanup */ + IoDeleteDevice(DeviceObject); + return STATUS_INSUFFICIENT_RESOURCES; } - pdoNullDevice->DeviceExtension = (PVOID)&nxNull; - - /* create zero device */ - nErrCode = IoCreateDevice(DriverObject, - sizeof(NULL_EXTENSION), - &wstrZeroDeviceName, - FILE_DEVICE_NULL, - FILE_READ_ONLY_DEVICE, /* zero device is read-only */ - FALSE, - &pdoZeroDevice); - - /* failure */ - if(!NT_SUCCESS(nErrCode)) - { - IoDeleteDevice(pdoNullDevice); - return (nErrCode); - } - - pdoZeroDevice->DeviceExtension = (PVOID)&nxZero; - pdoZeroDevice->Flags |= DO_BUFFERED_IO; - - return (nErrCode); + /* Initialize it */ + RtlZeroMemory(FastIoDispatch, sizeof(FAST_IO_DISPATCH)); + FastIoDispatch->SizeOfFastIoDispatch = sizeof(FAST_IO_DISPATCH); + + /* Setup our pointers */ + FastIoDispatch->FastIoRead = NullRead; + FastIoDispatch->FastIoWrite = NullWrite; + DriverObject->FastIoDispatch = FastIoDispatch; + + /* Return success */ + return STATUS_SUCCESS; } /* EOF */ Removed: trunk/reactos/drivers/base/null/null.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/null/null.h?r…
============================================================================== --- trunk/reactos/drivers/base/null/null.h (original) +++ trunk/reactos/drivers/base/null/null.h (removed) @@ -1,22 +1,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: services/dd/null/null.h - * PURPOSE: NULL device driver internal definitions - * PROGRAMMER: KJK::Hyperion <noog(a)libero.it> - * UPDATE HISTORY: - * 29/04/2002: Created - */ - -typedef enum __tagNULL_EXTENSION{ - NullBitBucket, - NullZeroStream, -} NULL_EXTENSION, *PNULL_EXTENSION; - -#define NULL_DEVICE_TYPE(__DEVICE__) (*((PNULL_EXTENSION)((__DEVICE__)->DeviceExtension))) - -NTSTATUS STDCALL -DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath); - -/* EOF */
17 years, 9 months
1
0
0
0
[ion] 26255: - Ignore generated files after hpoussin's change to make these files arch-specific.
by ion@svn.reactos.org
Author: ion Date: Tue Apr 3 20:03:24 2007 New Revision: 26255 URL:
http://svn.reactos.org/svn/reactos?rev=26255&view=rev
Log: - Ignore generated files after hpoussin's change to make these files arch-specific. Modified: trunk/reactos/dll/ntdll/ (props changed) trunk/reactos/dll/win32/gdi32/misc/ (props changed) trunk/reactos/dll/win32/user32/misc/ (props changed) trunk/reactos/ntoskrnl/ex/i386/ (props changed) Propchange: trunk/reactos/dll/ntdll/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Tue Apr 3 20:03:24 2007 @@ -13,3 +13,4 @@ GNUmakefile *.vcproj *.user +i386 Propchange: trunk/reactos/dll/win32/gdi32/misc/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Tue Apr 3 20:03:24 2007 @@ -1,3 +1,4 @@ win32k.S *.o .*.d +i386 Propchange: trunk/reactos/dll/win32/user32/misc/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Tue Apr 3 20:03:24 2007 @@ -3,3 +3,4 @@ *.a *.o *.sym +win32k.S Propchange: trunk/reactos/ntoskrnl/ex/i386/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Tue Apr 3 20:03:24 2007 @@ -1,2 +1,3 @@ *.d *.o +zw.S
17 years, 9 months
1
0
0
0
[ion] 26254: - Don't load NT4 audio drivers by default anymore. - Don't load beep.sys in non-setup mode. - Improve beep driver by making it use device queues instead of instantly completing beep requests, and make it cancel-safe, unloadable, and thread-safe in regards to timers. Also reduce memory footprint by making the entire driver pageable and dynamically locking/unlocking the image section by keeping a reference count of opens.
by ion@svn.reactos.org
Author: ion Date: Tue Apr 3 20:01:58 2007 New Revision: 26254 URL:
http://svn.reactos.org/svn/reactos?rev=26254&view=rev
Log: - Don't load NT4 audio drivers by default anymore. - Don't load beep.sys in non-setup mode. - Improve beep driver by making it use device queues instead of instantly completing beep requests, and make it cancel-safe, unloadable, and thread-safe in regards to timers. Also reduce memory footprint by making the entire driver pageable and dynamically locking/unlocking the image section by keeping a reference count of opens. Modified: trunk/reactos/boot/bootdata/hivesys.inf trunk/reactos/drivers/base/beep/beep.c Modified: trunk/reactos/boot/bootdata/hivesys.inf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/hivesys.inf?…
============================================================================== --- trunk/reactos/boot/bootdata/hivesys.inf (original) +++ trunk/reactos/boot/bootdata/hivesys.inf Tue Apr 3 20:01:58 2007 @@ -490,7 +490,7 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Blue","ErrorControl",0x00010001,0x00000000 HKLM,"SYSTEM\CurrentControlSet\Services\Blue","Group",0x00000000,"Video Init" HKLM,"SYSTEM\CurrentControlSet\Services\Blue","ImagePath",0x00020000,"system32\drivers\blue.sys" -HKLM,"SYSTEM\CurrentControlSet\Services\Blue","Start",0x00010001,0x00000001 +HKLM,"SYSTEM\CurrentControlSet\Services\Blue","Start",0x00010001,0x00000004 HKLM,"SYSTEM\CurrentControlSet\Services\Blue","Type",0x00010001,0x00000001 ; Cdfs (ISO96660) filesystem driver @@ -593,7 +593,7 @@ HKLM,"SYSTEM\CurrentControlSet\Services\sndblst","Group",0x00000000,"Base" HKLM,"SYSTEM\CurrentControlSet\Services\sndblst","ServiceType",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\sndblst","Type",0x00010001,0x00000001 -HKLM,"SYSTEM\CurrentControlSet\Services\sndblst","Start",0x00010001,0x00000001 +HKLM,"SYSTEM\CurrentControlSet\Services\sndblst","Start",0x00010001,0x00000004 HKLM,"SYSTEM\CurrentControlSet\Services\sndblst","ErrorControl",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\sndblst","ImagePath",0x00020000,"system32\drivers\sndblst.sys" ;HKLM,"SYSTEM\CurrentControlSet\Services\sndblst\Parameters\Device0","DmaChannel",0x00010001,0x00000001 @@ -608,7 +608,7 @@ HKLM,"SYSTEM\CurrentControlSet\Services\mpu401","Group",0x00000000,"Base" HKLM,"SYSTEM\CurrentControlSet\Services\mpu401","ServiceType",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\mpu401","Type",0x00010001,0x00000001 -HKLM,"SYSTEM\CurrentControlSet\Services\mpu401","Start",0x00010001,0x00000001 +HKLM,"SYSTEM\CurrentControlSet\Services\mpu401","Start",0x00010001,0x00000004 HKLM,"SYSTEM\CurrentControlSet\Services\mpu401","ErrorControl",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\mpu401","ImagePath",0x00020000,"system32\drivers\mpu401.sys" Modified: trunk/reactos/drivers/base/beep/beep.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/beep/beep.c?r…
============================================================================== --- trunk/reactos/drivers/base/beep/beep.c (original) +++ trunk/reactos/drivers/base/beep/beep.c Tue Apr 3 20:01:58 2007 @@ -1,282 +1,396 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: services/dd/beep/beep.c - * PURPOSE: BEEP device driver - * PROGRAMMER: Eric Kohl (ekohl(a)rz-online.de) - * UPDATE HISTORY: - * 30/01/99 Created - * 16/10/99 Minor fixes +/* + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory + * FILE: drivers/base/beep/beep.c + * PURPOSE: Beep Device Driver + * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org) + * Eric Kohl (ekohl(a)rz-online.de) */ -/* INCLUDES ****************************************************************/ +/* INCLUDES ******************************************************************/ #include <ntddk.h> #include <ntddbeep.h> - #define NDEBUG #include <debug.h> -NTSTATUS STDCALL -DriverEntry(PDRIVER_OBJECT DriverObject, - PUNICODE_STRING RegistryPath); - -/* TYEPEDEFS ***************************************************************/ +/* TYPES *********************************************************************/ typedef struct _BEEP_DEVICE_EXTENSION { - KDPC Dpc; - KTIMER Timer; - KEVENT Event; - BOOLEAN BeepOn; + LONG ReferenceCount; + FAST_MUTEX Mutex; + KTIMER Timer; + LONG TimerActive; + PVOID SectionHandle; } DEVICE_EXTENSION, *PDEVICE_EXTENSION; - -/* FUNCTIONS ***************************************************************/ - -static VOID STDCALL -BeepDPC(PKDPC Dpc, - PVOID DeferredContext, - PVOID SystemArgument1, - PVOID SystemArgument2) -{ - PDEVICE_EXTENSION DeviceExtension = DeferredContext; - - DPRINT("BeepDPC() called!\n"); - - HalMakeBeep(0); - DeviceExtension->BeepOn = FALSE; - KeSetEvent(&DeviceExtension->Event, - 0, - FALSE); - - DPRINT("BeepDPC() finished!\n"); -} - - -static NTSTATUS STDCALL -BeepCreate( - PDEVICE_OBJECT DeviceObject, - PIRP Irp) -/* - * FUNCTION: Handles user mode requests - * ARGUMENTS: - * DeviceObject = Device for request - * Irp = I/O request packet describing request - * RETURNS: Success or failure - */ -{ - DPRINT("BeepCreate() called!\n"); - - Irp->IoStatus.Status = STATUS_SUCCESS; - Irp->IoStatus.Information = 0; - IoCompleteRequest(Irp, - IO_NO_INCREMENT); - - return(STATUS_SUCCESS); -} - - -static NTSTATUS STDCALL -BeepClose(PDEVICE_OBJECT DeviceObject, - PIRP Irp) -/* - * FUNCTION: Handles user mode requests - * ARGUMENTS: - * DeviceObject = Device for request - * Irp = I/O request packet describing request - * RETURNS: Success or failure - */ -{ - PDEVICE_EXTENSION DeviceExtension; - NTSTATUS Status; - - DPRINT("BeepClose() called!\n"); - - DeviceExtension = DeviceObject->DeviceExtension; - if (DeviceExtension->BeepOn == TRUE) - { - HalMakeBeep(0); - DeviceExtension->BeepOn = FALSE; - KeCancelTimer(&DeviceExtension->Timer); - } - - Status = STATUS_SUCCESS; - - Irp->IoStatus.Status = Status; - Irp->IoStatus.Information = 0; - IoCompleteRequest(Irp, - IO_NO_INCREMENT); - - return(Status); -} - - -static NTSTATUS STDCALL -BeepCleanup(PDEVICE_OBJECT DeviceObject, - PIRP Irp) -/* - * FUNCTION: Handles user mode requests - * ARGUMENTS: - * DeviceObject = Device for request - * Irp = I/O request packet describing request - * RETURNS: Success or failure - */ -{ - DPRINT("BeepCleanup() called!\n"); - - Irp->IoStatus.Status = STATUS_SUCCESS; - Irp->IoStatus.Information = 0; - IoCompleteRequest(Irp, - IO_NO_INCREMENT); - - return(STATUS_SUCCESS); -} - - -static NTSTATUS STDCALL -BeepDeviceControl(PDEVICE_OBJECT DeviceObject, - PIRP Irp) -/* - * FUNCTION: Handles user mode requests - * ARGUMENTS: - * DeviceObject = Device for request - * Irp = I/O request packet describing request - * RETURNS: Success or failure - */ -{ - PIO_STACK_LOCATION Stack; - PDEVICE_EXTENSION DeviceExtension; - PBEEP_SET_PARAMETERS BeepParam; - LARGE_INTEGER DueTime; - - DPRINT("BeepDeviceControl() called!\n"); - - DeviceExtension = DeviceObject->DeviceExtension; - Stack = IoGetCurrentIrpStackLocation(Irp); - BeepParam = (PBEEP_SET_PARAMETERS)Irp->AssociatedIrp.SystemBuffer; - - Irp->IoStatus.Information = 0; - - if (Stack->Parameters.DeviceIoControl.IoControlCode != IOCTL_BEEP_SET) - { - Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED; - IoCompleteRequest(Irp, - IO_NO_INCREMENT); - return(STATUS_NOT_IMPLEMENTED); - } - - if ((Stack->Parameters.DeviceIoControl.InputBufferLength != sizeof(BEEP_SET_PARAMETERS)) - || (BeepParam->Frequency < BEEP_FREQUENCY_MINIMUM) - || (BeepParam->Frequency > BEEP_FREQUENCY_MAXIMUM)) - { - Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; - IoCompleteRequest(Irp, - IO_NO_INCREMENT); - return(STATUS_INVALID_PARAMETER); - } - - DueTime.QuadPart = 0; - - /* do the beep!! */ - DPRINT("Beep:\n Freq: %lu Hz\n Dur: %lu ms\n", - BeepParam->Frequency, - BeepParam->Duration); - if (BeepParam->Duration > 0) - { - DueTime.QuadPart = (LONGLONG)BeepParam->Duration * -10000; - - KeSetTimer(&DeviceExtension->Timer, - DueTime, - &DeviceExtension->Dpc); - - HalMakeBeep(BeepParam->Frequency); - DeviceExtension->BeepOn = TRUE; - KeWaitForSingleObject(&DeviceExtension->Event, - Executive, - KernelMode, - FALSE, - NULL); - } - else if (BeepParam->Duration == MAXULONG) - { - if (DeviceExtension->BeepOn == TRUE) - { - HalMakeBeep(0); - DeviceExtension->BeepOn = FALSE; - } - else - { - HalMakeBeep(BeepParam->Frequency); - DeviceExtension->BeepOn = TRUE; - } - } - - DPRINT("Did the beep!\n"); - - Irp->IoStatus.Status = STATUS_SUCCESS; - IoCompleteRequest(Irp, - IO_NO_INCREMENT); - return(STATUS_SUCCESS); -} - - -static VOID STDCALL -BeepUnload(PDRIVER_OBJECT DriverObject) -{ - DPRINT("BeepUnload() called!\n"); -} - - -NTSTATUS STDCALL -DriverEntry(PDRIVER_OBJECT DriverObject, - PUNICODE_STRING RegistryPath) -/* - * FUNCTION: Called by the system to initalize the driver - * ARGUMENTS: - * DriverObject = object describing this driver - * RegistryPath = path to our configuration entries - * RETURNS: Success or failure - */ -{ - PDEVICE_EXTENSION DeviceExtension; - PDEVICE_OBJECT DeviceObject; - UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\Beep"); - NTSTATUS Status; - - DPRINT("Beep Device Driver 0.0.3\n"); - - DriverObject->Flags = 0; - DriverObject->MajorFunction[IRP_MJ_CREATE] = BeepCreate; - DriverObject->MajorFunction[IRP_MJ_CLOSE] = BeepClose; - DriverObject->MajorFunction[IRP_MJ_CLEANUP] = BeepCleanup; - DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = BeepDeviceControl; - DriverObject->DriverUnload = BeepUnload; - - Status = IoCreateDevice(DriverObject, - sizeof(DEVICE_EXTENSION), - &DeviceName, - FILE_DEVICE_BEEP, - 0, - FALSE, - &DeviceObject); - if (!NT_SUCCESS(Status)) +/* FUNCTIONS *****************************************************************/ + +VOID +NTAPI +BeepDPC(IN PKDPC Dpc, + IN PDEVICE_OBJECT DeviceObject, + IN PVOID SystemArgument1, + IN PVOID SystemArgument2) +{ + PDEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension; + + /* Stop the beep */ + HalMakeBeep(0); + + /* Disable the timer */ + InterlockedDecrement(&DeviceExtension->TimerActive); +} + +NTSTATUS +NTAPI +BeepCreate(IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + PDEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension; + + /* Acquire the mutex and increase reference count */ + ExAcquireFastMutex(&DeviceExtension->Mutex); + if (++DeviceExtension->ReferenceCount == 1) + { + /* First reference, lock the data section */ + DeviceExtension->SectionHandle = MmLockPagableDataSection(BeepCreate); + } + + /* Release it */ + ExReleaseFastMutex(&DeviceExtension->Mutex); + + /* Complete the request */ + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_SUCCESS; +} + +NTSTATUS +NTAPI +BeepClose(IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + PDEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension; + + /* Acquire the mutex and decrease reference count */ + ExAcquireFastMutex(&DeviceExtension->Mutex); + if (!(--DeviceExtension->ReferenceCount)) + { + /* Check for active timer */ + if (DeviceExtension->TimerActive) + { + /* Cancel it */ + if (KeCancelTimer(&DeviceExtension->Timer)) + { + /* Mark it as cancelled */ + InterlockedDecrement(&DeviceExtension->TimerActive); + } + } + + /* Page the driver */ + MmUnlockPagableImageSection(DeviceExtension->SectionHandle); + } + + /* Release the lock */ + ExReleaseFastMutex(&DeviceExtension->Mutex); + + /* Complete the request */ + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_SUCCESS; +} + +VOID +NTAPI +BeepCancel(IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + /* Check if this is the current request */ + if (Irp == DeviceObject->CurrentIrp) + { + /* Clear it */ + DeviceObject->CurrentIrp = NULL; + + /* Release the cancel lock and start the next packet */ + IoReleaseCancelSpinLock(Irp->CancelIrql); + IoStartNextPacket(DeviceObject, TRUE); + } + else + { + /* Otherwise, remove the packet from the queue and relelase the lock */ + KeRemoveEntryDeviceQueue(&DeviceObject->DeviceQueue, + &Irp->Tail.Overlay.DeviceQueueEntry); + IoReleaseCancelSpinLock(Irp->CancelIrql); + } + + /* Complete the request */ + Irp->IoStatus.Status = STATUS_CANCELLED; + Irp->IoStatus.Information = 0; + IoCompleteRequest (Irp, IO_NO_INCREMENT); +} + +NTSTATUS +NTAPI +BeepCleanup(IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + KIRQL OldIrql, CancelIrql; + PKDEVICE_QUEUE_ENTRY Packet; + PIRP CurrentIrp; + + /* Raise IRQL and acquire the cancel lock */ + KeRaiseIrql(DISPATCH_LEVEL, &OldIrql); + IoAcquireCancelSpinLock(&CancelIrql); + + /* Get the current IRP */ + CurrentIrp = DeviceObject->CurrentIrp; + DeviceObject->CurrentIrp = NULL; + while (CurrentIrp) + { + /* Clear its cancel routine */ + (VOID)IoSetCancelRoutine(CurrentIrp, NULL); + + /* Cancel the IRP */ + CurrentIrp->IoStatus.Status = STATUS_CANCELLED; + CurrentIrp->IoStatus.Information = 0; + + /* Release the cancel lock and complete it */ + IoReleaseCancelSpinLock(CancelIrql); + IoCompleteRequest(CurrentIrp, IO_NO_INCREMENT); + + /* Reacquire the lock and get the next queue packet */ + IoAcquireCancelSpinLock(&CancelIrql); + Packet = KeRemoveDeviceQueue(&DeviceObject->DeviceQueue); + if (Packet) + { + /* Get the IRP */ + CurrentIrp = CONTAINING_RECORD(Packet, + IRP, + Tail.Overlay.DeviceQueueEntry); + } + else + { + /* No more IRPs */ + CurrentIrp = NULL; + } + } + + /* Release lock and go back to low IRQL */ + IoReleaseCancelSpinLock(CancelIrql); + KeLowerIrql(OldIrql); + + /* Complete the IRP */ + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + /* Stop and beep and return */ + HalMakeBeep(0); + return STATUS_SUCCESS; +} + +NTSTATUS +NTAPI +BeepDeviceControl(IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + PIO_STACK_LOCATION Stack; + PBEEP_SET_PARAMETERS BeepParam; + NTSTATUS Status; + + /* Get the stack location and parameters */ + Stack = IoGetCurrentIrpStackLocation(Irp); + BeepParam = (PBEEP_SET_PARAMETERS)Irp->AssociatedIrp.SystemBuffer; + + /* We only support one IOCTL */ + if (Stack->Parameters.DeviceIoControl.IoControlCode != IOCTL_BEEP_SET) + { + /* Unsupported command */ + Status = STATUS_NOT_IMPLEMENTED; + } + else + { + /* Validate the input buffer length */ + if (Stack->Parameters.DeviceIoControl.InputBufferLength < + sizeof(BEEP_SET_PARAMETERS)) + { + /* Invalid buffer */ + Status = STATUS_INVALID_PARAMETER; + } + else if ((BeepParam->Frequency != 0) && !(BeepParam->Duration)) + { + /* No duration, return imemdiately */ + Status = STATUS_SUCCESS; + } + else + { + /* We'll queue this request */ + Status = STATUS_PENDING; + } + } + + /* Set packet information */ + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = 0; + + /* Check if we're completing or queuing a packet */ + if (Status == STATUS_PENDING) + { + /* Start the queue */ + IoMarkIrpPending(Irp); + IoStartPacket(DeviceObject, Irp, NULL, BeepCancel); + } + else + { + /* Complete the request */ + IoCompleteRequest(Irp, IO_NO_INCREMENT); + } + + /* Return */ return Status; - - /* set up device extension */ - DeviceExtension = DeviceObject->DeviceExtension; - DeviceExtension->BeepOn = FALSE; - - KeInitializeDpc(&DeviceExtension->Dpc, - BeepDPC, - DeviceExtension); - KeInitializeTimer(&DeviceExtension->Timer); - KeInitializeEvent(&DeviceExtension->Event, - SynchronizationEvent, - FALSE); - - return(STATUS_SUCCESS); +} + +VOID +NTAPI +BeepUnload(IN PDRIVER_OBJECT DriverObject) +{ + PDEVICE_EXTENSION DeviceExtension; + PDEVICE_OBJECT DeviceObject; + + /* Get DO and DE */ + DeviceObject = DriverObject->DeviceObject; + DeviceExtension = DeviceObject->DeviceExtension; + + /* Check if the timer is active */ + if (DeviceExtension->TimerActive) + { + /* Cancel it */ + if (KeCancelTimer(&DeviceExtension->Timer)) + { + /* All done */ + InterlockedDecrement(&DeviceExtension->TimerActive); + } + } + + /* Delete the object */ + IoDeleteDevice(DeviceObject); +} + +VOID +NTAPI +BeepStartIo(IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + PDEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension; + KIRQL CancelIrql; + PIO_STACK_LOCATION IoStack; + PBEEP_SET_PARAMETERS BeepParam; + LARGE_INTEGER DueTime; + NTSTATUS Status; + + /* Acquire the cancel lock and make sure the IRP is valid */ + IoAcquireCancelSpinLock(&CancelIrql); + if (!Irp) + { + /* It's not, release the lock and quit */ + IoReleaseCancelSpinLock(CancelIrql); + return; + } + + /* Remove the cancel routine and release the lock */ + (VOID)IoSetCancelRoutine(Irp, NULL); + IoReleaseCancelSpinLock(CancelIrql); + + /* Get the I/O Stack and make sure the request is valid */ + BeepParam = (PBEEP_SET_PARAMETERS)Irp->AssociatedIrp.SystemBuffer; + IoStack = IoGetCurrentIrpStackLocation(Irp); + if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_BEEP_SET) + { + /* Check if we have an active timer */ + if (DeviceExtension->TimerActive) + { + /* Cancel it */ + if (KeCancelTimer(&DeviceExtension->Timer)) + { + /* Set the state */ + InterlockedDecrement(&DeviceExtension->TimerActive); + } + } + + /* Make the beep */ + if (HalMakeBeep(BeepParam->Frequency)) + { + /* Beep successful, queue a DPC to stop it */ + Status = STATUS_SUCCESS; + DueTime.QuadPart = BeepParam->Duration * -10000; + InterlockedIncrement(&DeviceExtension->TimerActive); + KeSetTimer(&DeviceExtension->Timer, DueTime, &DeviceObject->Dpc); + } + else + { + /* Beep has failed */ + Status = STATUS_INVALID_PARAMETER; + } + } + else + { + /* Invalid request */ + Status = STATUS_INVALID_PARAMETER; + } + + /* Complete the request and start the next packet */ + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = 0; + IoStartNextPacket(DeviceObject, TRUE); + IoCompleteRequest(Irp, IO_NO_INCREMENT); +} + +NTSTATUS +NTAPI +DriverEntry(IN PDRIVER_OBJECT DriverObject, + IN PUNICODE_STRING RegistryPath) +{ + PDEVICE_EXTENSION DeviceExtension; + PDEVICE_OBJECT DeviceObject; + UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\Beep"); + NTSTATUS Status; + + /* Create the device */ + Status = IoCreateDevice(DriverObject, + sizeof(DEVICE_EXTENSION), + &DeviceName, + FILE_DEVICE_BEEP, + 0, + FALSE, + &DeviceObject); + if (!NT_SUCCESS(Status)) return Status; + + /* Make it use buffered I/O */ + DeviceObject->Flags |= DO_BUFFERED_IO; + + /* Setup the Driver Object */ + DriverObject->MajorFunction[IRP_MJ_CREATE] = BeepCreate; + DriverObject->MajorFunction[IRP_MJ_CLOSE] = BeepClose; + DriverObject->MajorFunction[IRP_MJ_CLEANUP] = BeepCleanup; + DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = BeepDeviceControl; + DriverObject->DriverUnload = BeepUnload; + DriverObject->DriverStartIo = BeepStartIo; + + /* Set up device extension */ + DeviceExtension = DeviceObject->DeviceExtension; + DeviceExtension->ReferenceCount = 0; + DeviceExtension->TimerActive = FALSE; + IoInitializeDpcRequest(DeviceObject, BeepDPC); + KeInitializeTimer(&DeviceExtension->Timer); + ExInitializeFastMutex(&DeviceExtension->Mutex); + + /* Page the entire driver */ + MmPageEntireDriver(DriverEntry); + return STATUS_SUCCESS; } /* EOF */
17 years, 9 months
1
0
0
0
← Newer
1
...
32
33
34
35
36
37
38
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
Results per page:
10
25
50
100
200