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
[sginsberg] 35434: - Remove broken IoReportTargetDeviceChange implementation on Alex's request
by sginsberg@svn.reactos.org
Author: sginsberg Date: Mon Aug 18 12:07:09 2008 New Revision: 35434 URL:
http://svn.reactos.org/svn/reactos?rev=35434&view=rev
Log: - Remove broken IoReportTargetDeviceChange implementation on Alex's request Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnprepo…
============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c [iso-8859-1] Mon Aug 18 12:07:09 2008 @@ -119,27 +119,8 @@ IoReportTargetDeviceChange(IN PDEVICE_OBJECT PhysicalDeviceObject, IN PVOID NotificationStructure) { - KEVENT Event; - NTSTATUS Status; - - /* Initialize the event */ - KeInitializeEvent(&Event, NotificationEvent, FALSE); - - /* Call the asynchronous version */ - Status = IoReportTargetDeviceChangeAsynchronous(PhysicalDeviceObject, - NotificationStructure, - IopSetEvent, - &Event); - - /* Only wait if we succeeded */ - if (NT_SUCCESS(Status)) - { - /* Wait for it to complete */ - KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL); - } - - /* Return status */ - return Status; + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; } /*
16 years, 2 months
1
0
0
0
[sginsberg] 35433: - Replace the remaining X86_EFLAGS* with EFLAGS_* - Add missing EFLAGS_* to NDK
by sginsberg@svn.reactos.org
Author: sginsberg Date: Mon Aug 18 12:05:31 2008 New Revision: 35433 URL:
http://svn.reactos.org/svn/reactos?rev=35433&view=rev
Log: - Replace the remaining X86_EFLAGS* with EFLAGS_* - Add missing EFLAGS_* to NDK Modified: trunk/reactos/include/ndk/i386/ketypes.h trunk/reactos/ntoskrnl/include/internal/i386/ke.h trunk/reactos/ntoskrnl/kdbg/kdb.c trunk/reactos/ntoskrnl/ke/i386/cpu.c Modified: trunk/reactos/include/ndk/i386/ketypes.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/i386/ketypes.h…
============================================================================== --- trunk/reactos/include/ndk/i386/ketypes.h [iso-8859-1] (original) +++ trunk/reactos/include/ndk/i386/ketypes.h [iso-8859-1] Mon Aug 18 12:05:31 2008 @@ -88,11 +88,14 @@ #define EFLAGS_TF 0x100L #define EFLAGS_INTERRUPT_MASK 0x200L #define EFLAGS_DF 0x400L +#define EFLAGS_IOPL 0x3000L #define EFLAGS_NESTED_TASK 0x4000L +#define EFLAGS_RF 0x10000 #define EFLAGS_V86_MASK 0x20000 #define EFLAGS_ALIGN_CHECK 0x40000 #define EFLAGS_VIF 0x80000 #define EFLAGS_VIP 0x100000 +#define EFLAGS_ID 0x200000 #define EFLAGS_USER_SANITIZE 0x3F4DD7 #define EFLAG_SIGN 0x8000 #define EFLAG_ZERO 0x4000 Modified: trunk/reactos/ntoskrnl/include/internal/i386/ke.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/i386/ke.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/i386/ke.h [iso-8859-1] Mon Aug 18 12:05:31 2008 @@ -4,42 +4,6 @@ #if __GNUC__ >=3 #pragma GCC system_header #endif - -#define X86_EFLAGS_TF 0x00000100 /* Trap flag */ -#define X86_EFLAGS_IF 0x00000200 /* Interrupt Enable flag */ -#define X86_EFLAGS_IOPL 0x00003000 /* I/O Privilege Level bits */ -#define X86_EFLAGS_NT 0x00004000 /* Nested Task flag */ -#define X86_EFLAGS_RF 0x00010000 /* Resume flag */ -#define X86_EFLAGS_VM 0x00020000 /* Virtual Mode */ -#define X86_EFLAGS_ID 0x00200000 /* CPUID detection flag */ - -#define X86_CR0_PE 0x00000001 /* enable Protected Mode */ -#define X86_CR0_NE 0x00000020 /* enable native FPU error reporting */ -#define X86_CR0_TS 0x00000008 /* enable exception on FPU instruction for task switch */ -#define X86_CR0_EM 0x00000004 /* enable FPU emulation (disable FPU) */ -#define X86_CR0_MP 0x00000002 /* enable FPU monitoring */ -#define X86_CR0_WP 0x00010000 /* enable Write Protect (copy on write) */ -#define X86_CR0_PG 0x80000000 /* enable Paging */ - -#define X86_CR4_PAE 0x00000020 /* enable physical address extensions */ -#define X86_CR4_PGE 0x00000080 /* enable global pages */ -#define X86_CR4_OSFXSR 0x00000200 /* enable FXSAVE/FXRSTOR instructions */ -#define X86_CR4_OSXMMEXCPT 0x00000400 /* enable #XF exception */ - -#define X86_FEATURE_VME 0x00000002 /* Virtual 8086 Extensions are present */ -#define X86_FEATURE_TSC 0x00000010 /* time stamp counters are present */ -#define X86_FEATURE_PAE 0x00000040 /* physical address extension is present */ -#define X86_FEATURE_CX8 0x00000100 /* CMPXCHG8B instruction present */ -#define X86_FEATURE_SYSCALL 0x00000800 /* SYSCALL/SYSRET support present */ -#define X86_FEATURE_PGE 0x00002000 /* Page Global Enable */ -#define X86_FEATURE_MMX 0x00800000 /* MMX extension present */ -#define X86_FEATURE_FXSR 0x01000000 /* FXSAVE/FXRSTOR instructions present */ -#define X86_FEATURE_SSE 0x02000000 /* SSE extension present */ -#define X86_FEATURE_SSE2 0x04000000 /* SSE2 extension present */ -#define X86_FEATURE_HT 0x10000000 /* Hyper-Threading present */ - -#define X86_EXT_FEATURE_SSE3 0x00000001 /* SSE3 extension present */ -#define X86_EXT_FEATURE_3DNOW 0x40000000 /* 3DNOW! extension present */ #define FRAME_EDITED 0xFFF8 Modified: trunk/reactos/ntoskrnl/kdbg/kdb.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kdbg/kdb.c?rev=35…
============================================================================== --- trunk/reactos/ntoskrnl/kdbg/kdb.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/kdbg/kdb.c [iso-8859-1] Mon Aug 18 12:05:31 2008 @@ -1349,7 +1349,7 @@ else if (BreakPoint->Type == KdbBreakPointTemporary && BreakPoint->Process == KdbCurrentProcess) { - ASSERT((TrapFrame->EFlags & X86_EFLAGS_TF) == 0); + ASSERT((TrapFrame->EFlags & EFLAGS_TF) == 0); /* * Delete the temporary breakpoint which was used to step over or into the instruction. @@ -1361,7 +1361,7 @@ if ((KdbSingleStepOver && !KdbpStepOverInstruction(TrapFrame->Eip)) || (!KdbSingleStepOver && !KdbpStepIntoInstruction(TrapFrame->Eip))) { - Context->EFlags |= X86_EFLAGS_TF; + Context->EFlags |= EFLAGS_TF; } goto continue_execution; /* return */ } @@ -1377,7 +1377,7 @@ BreakPoint->Type == KdbBreakPointTemporary) { ASSERT(ExceptionCode == STATUS_BREAKPOINT); - Context->EFlags |= X86_EFLAGS_TF; + Context->EFlags |= EFLAGS_TF; KdbBreakPointToReenable = BreakPoint; } @@ -1450,30 +1450,30 @@ /* Unset TF if we are no longer single stepping. */ if (KdbNumSingleSteps == 0) - Context->EFlags &= ~X86_EFLAGS_TF; + Context->EFlags &= ~EFLAGS_TF; goto continue_execution; /* return */ } /* Check if we expect a single step */ if ((TrapFrame->Dr6 & 0xf) == 0 && KdbNumSingleSteps > 0) { - /*ASSERT((Context->Eflags & X86_EFLAGS_TF) != 0);*/ + /*ASSERT((Context->Eflags & EFLAGS_TF) != 0);*/ if (--KdbNumSingleSteps > 0) { if ((KdbSingleStepOver && KdbpStepOverInstruction(TrapFrame->Eip)) || (!KdbSingleStepOver && KdbpStepIntoInstruction(TrapFrame->Eip))) { - Context->EFlags &= ~X86_EFLAGS_TF; + Context->EFlags &= ~EFLAGS_TF; } else { - Context->EFlags |= X86_EFLAGS_TF; + Context->EFlags |= EFLAGS_TF; } goto continue_execution; /* return */ } else { - Context->EFlags &= ~X86_EFLAGS_TF; + Context->EFlags &= ~EFLAGS_TF; KdbEnteredOnSingleStep = TRUE; } } @@ -1574,12 +1574,12 @@ if ((KdbSingleStepOver && KdbpStepOverInstruction(KdbCurrentTrapFrame->Tf.Eip)) || (!KdbSingleStepOver && KdbpStepIntoInstruction(KdbCurrentTrapFrame->Tf.Eip))) { - ASSERT((KdbCurrentTrapFrame->Tf.EFlags & X86_EFLAGS_TF) == 0); - /*KdbCurrentTrapFrame->Tf.EFlags &= ~X86_EFLAGS_TF;*/ + ASSERT((KdbCurrentTrapFrame->Tf.EFlags & EFLAGS_TF) == 0); + /*KdbCurrentTrapFrame->Tf.EFlags &= ~EFLAGS_TF;*/ } else { - Context->EFlags |= X86_EFLAGS_TF; + Context->EFlags |= EFLAGS_TF; } } @@ -1608,7 +1608,7 @@ /* Set the RF flag so we don't trigger the same breakpoint again. */ if (Resume) { - TrapFrame->EFlags |= X86_EFLAGS_RF; + TrapFrame->EFlags |= EFLAGS_RF; } /* Clear dr6 status flags. */ Modified: trunk/reactos/ntoskrnl/ke/i386/cpu.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/cpu.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/cpu.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/i386/cpu.c [iso-8859-1] Mon Aug 18 12:05:31 2008 @@ -127,7 +127,7 @@ Ke386SaveFlags(EFlags); /* XOR out the ID bit and update EFlags */ - NewEFlags = EFlags ^ X86_EFLAGS_ID; + NewEFlags = EFlags ^ EFLAGS_ID; Ke386RestoreFlags(NewEFlags); /* Get them back and see if they were modified */ @@ -135,7 +135,7 @@ if (NewEFlags != EFlags) { /* The modification worked, so CPUID exists. Set the ID Bit again. */ - EFlags |= X86_EFLAGS_ID; + EFlags |= EFLAGS_ID; Ke386RestoreFlags(EFlags); /* Peform CPUID 0 to see if CPUID 1 is supported */
16 years, 2 months
1
0
0
0
[ekohl] 35432: Implement the "Add users to a group" function.
by ekohl@svn.reactos.org
Author: ekohl Date: Mon Aug 18 09:08:22 2008 New Revision: 35432 URL:
http://svn.reactos.org/svn/reactos?rev=35432&view=rev
Log: Implement the "Add users to a group" function. Modified: trunk/reactos/dll/cpl/usrmgr/groupprops.c trunk/reactos/dll/cpl/usrmgr/lang/en-US.rc Modified: trunk/reactos/dll/cpl/usrmgr/groupprops.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/groupprops.…
============================================================================== --- trunk/reactos/dll/cpl/usrmgr/groupprops.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/usrmgr/groupprops.c [iso-8859-1] Mon Aug 18 09:08:22 2008 @@ -56,6 +56,252 @@ { dwSidSize += wsprintf(pTextSid + dwSidSize, TEXT("-%lu"), *GetSidSubAuthority(pSid, dwCounter)); + } +} + + +static VOID +InitGroupMembersList(HWND hwndDlg, + PGENERAL_GROUP_DATA pGroupData) +{ + HWND hwndLV; + LV_COLUMN column; + RECT rect; + TCHAR szStr[32]; + HIMAGELIST hImgList; + HICON hIcon; + + NET_API_STATUS netStatus; + PUSER_INFO_20 pUserBuffer; + DWORD entriesread; + DWORD totalentries; + DWORD resume_handle = 0; + DWORD i; + LV_ITEM lvi; + INT iItem; + + hwndLV = GetDlgItem(hwndDlg, IDC_USER_ADD_MEMBERSHIP_LIST); + GetClientRect(hwndLV, &rect); + + hImgList = ImageList_Create(16,16,ILC_COLOR8 | ILC_MASK,5,5); + hIcon = LoadImage(hApplet,MAKEINTRESOURCE(IDI_GROUP),IMAGE_ICON,16,16,LR_DEFAULTCOLOR); + ImageList_AddIcon(hImgList,hIcon); + DestroyIcon(hIcon); + hIcon = LoadImage(hApplet, MAKEINTRESOURCE(IDI_USER), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); + ImageList_AddIcon(hImgList, hIcon); + DestroyIcon(hIcon); + hIcon = LoadImage(hApplet, MAKEINTRESOURCE(IDI_LOCKED_USER), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); + ImageList_AddIcon(hImgList, hIcon); + DestroyIcon(hIcon); + + (void)ListView_SetImageList(hwndLV, hImgList, LVSIL_SMALL); + (void)ListView_SetExtendedListViewStyle(hwndLV, LVS_EX_FULLROWSELECT); + + memset(&column, 0x00, sizeof(column)); + column.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM | LVCF_TEXT; + column.fmt = LVCFMT_LEFT; + column.cx = (INT)((rect.right - rect.left) * 0.40); + column.iSubItem = 0; + LoadString(hApplet, IDS_NAME, szStr, sizeof(szStr) / sizeof(szStr[0])); + column.pszText = szStr; + (void)ListView_InsertColumn(hwndLV, 0, &column); + + column.cx = (INT)((rect.right - rect.left) * 0.60); + column.iSubItem = 1; + LoadString(hApplet, IDS_DESCRIPTION, szStr, sizeof(szStr) / sizeof(szStr[0])); + column.pszText = szStr; + (void)ListView_InsertColumn(hwndLV, 1, &column); + + /* TODO: Enumerate global groups and add them to the list! */ + + for (;;) + { + netStatus = NetUserEnum(NULL, 20, FILTER_NORMAL_ACCOUNT, + (LPBYTE*)&pUserBuffer, + 1024, &entriesread, + &totalentries, &resume_handle); + if (netStatus != NERR_Success && netStatus != ERROR_MORE_DATA) + break; + + for (i = 0; i < entriesread; i++) + { + memset(&lvi, 0x00, sizeof(lvi)); + lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_IMAGE; + lvi.pszText = pUserBuffer[i].usri20_name; + lvi.state = 0; + lvi.iImage = (pUserBuffer[i].usri20_flags & UF_ACCOUNTDISABLE) ? 2 : 1; + iItem = ListView_InsertItem(hwndLV, &lvi); + + ListView_SetItemText(hwndLV, iItem, 1, + pUserBuffer[i].usri20_full_name); + + ListView_SetItemText(hwndLV, iItem, 2, + pUserBuffer[i].usri20_comment); + } + + NetApiBufferFree(&pUserBuffer); + + /* No more data left */ + if (netStatus != ERROR_MORE_DATA) + break; + } +} + + +static BOOL +AddSelectedUsersToGroup(HWND hwndDlg, + PGENERAL_GROUP_DATA pGroupData) +{ + HWND hwndLV; + INT nSelectedItems; + INT nItem; + TCHAR szUserName[UNLEN]; + BOOL bResult = FALSE; + LOCALGROUP_MEMBERS_INFO_3 memberInfo; + NET_API_STATUS status; + + hwndLV = GetDlgItem(hwndDlg, IDC_USER_ADD_MEMBERSHIP_LIST); + + nSelectedItems = ListView_GetSelectedCount(hwndLV); + if (nSelectedItems > 0) + { + nItem = ListView_GetNextItem(hwndLV, -1, LVNI_SELECTED); + while (nItem != -1) + { + /* Get the new user name */ + ListView_GetItemText(hwndLV, + nItem, 0, + szUserName, + UNLEN); + + DebugPrintf(_TEXT("Selected user: %s"), szUserName); + + memberInfo.lgrmi3_domainandname = szUserName; + + status = NetLocalGroupAddMembers(NULL, pGroupData->szGroupName, 3, + (LPBYTE)&memberInfo, 1); + if (status != NERR_Success && status != ERROR_MEMBER_IN_ALIAS) + { + TCHAR szText[256]; + wsprintf(szText, TEXT("Error: %u"), status); + MessageBox(NULL, szText, TEXT("NetLocalGroupAddMembers"), MB_ICONERROR | MB_OK); + } + else + { + bResult = TRUE; + } + + nItem = ListView_GetNextItem(hwndLV, nItem, LVNI_SELECTED); + } + } + + return bResult; +} + + +INT_PTR CALLBACK +AddUsersToGroupDlgProc(HWND hwndDlg, + UINT uMsg, + WPARAM wParam, + LPARAM lParam) +{ + PGENERAL_GROUP_DATA pGroupData; + + UNREFERENCED_PARAMETER(wParam); + + pGroupData = (PGENERAL_GROUP_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER); + + switch (uMsg) + { + case WM_INITDIALOG: + pGroupData = (PGENERAL_GROUP_DATA)lParam; + SetWindowLongPtr(hwndDlg, DWLP_USER, (INT_PTR)pGroupData); + InitGroupMembersList(hwndDlg, pGroupData); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDOK: + if (AddSelectedUsersToGroup(hwndDlg, pGroupData)) + EndDialog(hwndDlg, IDOK); + else + EndDialog(hwndDlg, IDCANCEL); + break; + + case IDCANCEL: + EndDialog(hwndDlg, IDCANCEL); + break; + } + break; + + default: + return FALSE; + } + + return TRUE; +} + + +static VOID +AddUsersToGroup(HWND hwndDlg, + PGENERAL_GROUP_DATA pGroupData) +{ + HWND hwndLV; +// NET_API_STATUS status; + PLOCALGROUP_MEMBERS_INFO_1 membersInfo = NULL; + DWORD dwRead; + DWORD dwTotal; + DWORD_PTR resumeHandle = 0; + DWORD i; + LV_ITEM lvi; + TCHAR szGroupName[256]; + + if (DialogBoxParam(hApplet, + MAKEINTRESOURCE(IDD_USER_ADD_MEMBERSHIP), + hwndDlg, + AddUsersToGroupDlgProc, + (LPARAM)pGroupData) == IDOK) + { + hwndLV = GetDlgItem(hwndDlg, IDC_GROUP_GENERAL_MEMBERS); + + (void)ListView_DeleteAllItems(hwndLV); + +// DebugPrintf(_T("Removed all users from the list!")); + + /* Set group members */ + NetLocalGroupGetMembers(NULL, pGroupData->szGroupName, 1, (LPBYTE*)&membersInfo, + MAX_PREFERRED_LENGTH, &dwRead, &dwTotal, + &resumeHandle); + + for (i = 0; i < dwRead; i++) + { + ZeroMemory(&lvi, sizeof(lvi)); + lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_IMAGE; + lvi.pszText = membersInfo[i].lgrmi1_name; + lvi.state = 0; + lvi.iImage = (membersInfo[i].lgrmi1_sidusage == SidTypeGroup || + membersInfo[i].lgrmi1_sidusage == SidTypeWellKnownGroup) ? 1 : 0; + + if (membersInfo[i].lgrmi1_sidusage == SidTypeWellKnownGroup) + { + TCHAR szSid[256]; + + GetTextSid(membersInfo[i].lgrmi1_sid, szSid); + + wsprintf(szGroupName, + TEXT("%s (%s)"), + membersInfo[i].lgrmi1_name, + szSid); + + lvi.pszText = szGroupName; + } + + + (void)ListView_InsertItem(hwndLV, &lvi); + } + + NetApiBufferFree(membersInfo); } } @@ -161,9 +407,10 @@ /* Create the image list */ hImgList = ImageList_Create(16, 16, ILC_COLOR8 | ILC_MASK, 5, 5); + hIcon = LoadImage(hApplet, MAKEINTRESOURCE(IDI_GROUP), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); + ImageList_AddIcon(hImgList, hIcon); + DestroyIcon(hIcon); hIcon = LoadImage(hApplet, MAKEINTRESOURCE(IDI_USER), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); - ImageList_AddIcon(hImgList, hIcon); - hIcon = LoadImage(hApplet, MAKEINTRESOURCE(IDI_GROUP), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); ImageList_AddIcon(hImgList, hIcon); DestroyIcon(hIcon); @@ -198,8 +445,16 @@ lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_IMAGE; lvi.pszText = membersInfo[i].lgrmi1_name; lvi.state = 0; - lvi.iImage = (membersInfo[i].lgrmi1_sidusage == SidTypeGroup || - membersInfo[i].lgrmi1_sidusage == SidTypeWellKnownGroup) ? 1 : 0; + if (membersInfo[i].lgrmi1_sidusage == SidTypeGroup || + membersInfo[i].lgrmi1_sidusage == SidTypeWellKnownGroup) + { + lvi.iImage = 0; + } + else if (membersInfo[i].lgrmi1_sidusage == SidTypeUser) + { + /* FIXME: handle locked user properly! */ + lvi.iImage = 1; + } if (membersInfo[i].lgrmi1_sidusage == SidTypeWellKnownGroup) { @@ -208,7 +463,7 @@ GetTextSid(membersInfo[i].lgrmi1_sid, szSid); wsprintf(szGroupName, - TEXT("%s\\%s (%s)"), + TEXT("%s (%s)"), membersInfo[i].lgrmi1_name, szSid); @@ -293,6 +548,10 @@ case IDC_GROUP_GENERAL_DESCRIPTION: if (HIWORD(wParam) == EN_CHANGE) PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + break; + + case IDC_GROUP_GENERAL_ADD: + AddUsersToGroup(hwndDlg, pGroupData); break; case IDC_GROUP_GENERAL_REMOVE: Modified: trunk/reactos/dll/cpl/usrmgr/lang/en-US.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/lang/en-US.…
============================================================================== --- trunk/reactos/dll/cpl/usrmgr/lang/en-US.rc [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/usrmgr/lang/en-US.rc [iso-8859-1] Mon Aug 18 09:08:22 2008 @@ -99,7 +99,7 @@ LTEXT "Members:", -1, 7, 63, 45, 8 CONTROL "", IDC_GROUP_GENERAL_MEMBERS, "SysListView32", LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, 7, 74, 238, 117, WS_EX_CLIENTEDGE - PUSHBUTTON "Add...", IDC_GROUP_GENERAL_ADD, 7, 197, 50, 14, WS_DISABLED + PUSHBUTTON "Add...", IDC_GROUP_GENERAL_ADD, 7, 197, 50, 14 PUSHBUTTON "Remove", IDC_GROUP_GENERAL_REMOVE, 61, 197, 50, 14, WS_DISABLED END @@ -164,8 +164,8 @@ LTEXT "Member of:", -1, 7, 7, 56, 8 CONTROL "", IDC_USER_ADD_MEMBERSHIP_LIST, "SysListView32", LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, 7, 18, 238, 173, WS_EX_CLIENTEDGE - DEFPUSHBUTTON "OK",IDOK,156,197,50,14 - PUSHBUTTON "Cancel",IDCANCEL,210,197,50,14 + DEFPUSHBUTTON "OK",IDOK,141,197,50,14 + PUSHBUTTON "Cancel",IDCANCEL,195,197,50,14 END
16 years, 2 months
1
0
0
0
[cgutman] 35431: - Call MmProbeAndLockPages for SysMdl
by cgutman@svn.reactos.org
Author: cgutman Date: Mon Aug 18 09:00:27 2008 New Revision: 35431 URL:
http://svn.reactos.org/svn/reactos?rev=35431&view=rev
Log: - Call MmProbeAndLockPages for SysMdl Modified: branches/aicom-network-fixes/drivers/network/afd/afd/info.c Modified: branches/aicom-network-fixes/drivers/network/afd/afd/info.c URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
============================================================================== --- branches/aicom-network-fixes/drivers/network/afd/afd/info.c [iso-8859-1] (original) +++ branches/aicom-network-fixes/drivers/network/afd/afd/info.c [iso-8859-1] Mon Aug 18 09:00:27 2008 @@ -125,12 +125,20 @@ } if( SysMdl ) { - MmBuildMdlForNonPagedPool( SysMdl ); + _SEH_TRY { + MmProbeAndLockPages( SysMdl, Irp->RequestorMode, IoModifyAccess ); + } _SEH_HANDLE { + AFD_DbgPrint(MIN_TRACE, ("MmProbeAndLockPages() failed.\n")); + Status = _SEH_GetExceptionCode(); + } _SEH_END; + } else Status = STATUS_NO_MEMORY; + + if( NT_SUCCESS(Status) ) { Status = TdiQueryInformation ( FCB->AddressFile.Object, TDI_QUERY_CONNECTION_INFO, SysMdl ); - } else Status = STATUS_NO_MEMORY; + } if( NT_SUCCESS(Status) ) { TransAddr =
16 years, 2 months
1
0
0
0
[sginsberg] 35430: - Missed a STDCALL -> NTAPI
by sginsberg@svn.reactos.org
Author: sginsberg Date: Mon Aug 18 08:35:52 2008 New Revision: 35430 URL:
http://svn.reactos.org/svn/reactos?rev=35430&view=rev
Log: - Missed a STDCALL -> NTAPI Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnproot…
============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c [iso-8859-1] Mon Aug 18 08:35:52 2008 @@ -1062,7 +1062,7 @@ } NTSTATUS -STDCALL +NTAPI PnpRootAddDevice( IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject)
16 years, 2 months
1
0
0
0
[sginsberg] 35429: - Fix a typo (and build)
by sginsberg@svn.reactos.org
Author: sginsberg Date: Mon Aug 18 08:33:40 2008 New Revision: 35429 URL:
http://svn.reactos.org/svn/reactos?rev=35429&view=rev
Log: - Fix a typo (and build) Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnprepo…
============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c [iso-8859-1] Mon Aug 18 08:33:40 2008 @@ -128,7 +128,7 @@ /* Call the asynchronous version */ Status = IoReportTargetDeviceChangeAsynchronous(PhysicalDeviceObject, NotificationStructure, - IopClearEvent, + IopSetEvent, &Event); /* Only wait if we succeeded */
16 years, 2 months
1
0
0
0
[sginsberg] 35428: - Implement IoReportTargetDeviceChange as a wrapper around the unimplemented IoReportTargetDeviceChangeAsynchronous
by sginsberg@svn.reactos.org
Author: sginsberg Date: Mon Aug 18 08:31:33 2008 New Revision: 35428 URL:
http://svn.reactos.org/svn/reactos?rev=35428&view=rev
Log: - Implement IoReportTargetDeviceChange as a wrapper around the unimplemented IoReportTargetDeviceChangeAsynchronous Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnprepo…
============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c [iso-8859-1] Mon Aug 18 08:31:33 2008 @@ -119,8 +119,27 @@ IoReportTargetDeviceChange(IN PDEVICE_OBJECT PhysicalDeviceObject, IN PVOID NotificationStructure) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + KEVENT Event; + NTSTATUS Status; + + /* Initialize the event */ + KeInitializeEvent(&Event, NotificationEvent, FALSE); + + /* Call the asynchronous version */ + Status = IoReportTargetDeviceChangeAsynchronous(PhysicalDeviceObject, + NotificationStructure, + IopClearEvent, + &Event); + + /* Only wait if we succeeded */ + if (NT_SUCCESS(Status)) + { + /* Wait for it to complete */ + KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL); + } + + /* Return status */ + return Status; } /*
16 years, 2 months
1
0
0
0
[sginsberg] 35427: - Cleanup and reformat parts of pnpmgr (no code change)
by sginsberg@svn.reactos.org
Author: sginsberg Date: Mon Aug 18 08:30:17 2008 New Revision: 35427 URL:
http://svn.reactos.org/svn/reactos?rev=35427&view=rev
Log: - Cleanup and reformat parts of pnpmgr (no code change) Modified: trunk/reactos/ntoskrnl/io/pnpmgr/plugplay.c trunk/reactos/ntoskrnl/io/pnpmgr/pnpdma.c trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c trunk/reactos/ntoskrnl/io/pnpmgr/pnpnotify.c trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c Modified: trunk/reactos/ntoskrnl/io/pnpmgr/plugplay.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/plugpla…
============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/plugplay.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/plugplay.c [iso-8859-1] Mon Aug 18 08:30:17 2008 @@ -1,16 +1,14 @@ /* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/plugplay.c + * PROJECT: ReactOS Kernel + * COPYRIGHT: GPL - See COPYING in the top level directory + * FILE: ntoskrnl/io/pnpmgr/plugplay.c * PURPOSE: Plug-and-play interface routines - * * PROGRAMMERS: Eric Kohl <eric.kohl(a)t-online.de> */ /* INCLUDES *****************************************************************/ #include <ntoskrnl.h> - #define NDEBUG #include <internal/debug.h> @@ -113,127 +111,6 @@ return STATUS_SUCCESS; } - - -/* - * Plug and Play event structure used by NtGetPlugPlayEvent. - * - * EventGuid - * Can be one of the following values: - * GUID_HWPROFILE_QUERY_CHANGE - * GUID_HWPROFILE_CHANGE_CANCELLED - * GUID_HWPROFILE_CHANGE_COMPLETE - * GUID_TARGET_DEVICE_QUERY_REMOVE - * GUID_TARGET_DEVICE_REMOVE_CANCELLED - * GUID_TARGET_DEVICE_REMOVE_COMPLETE - * GUID_PNP_CUSTOM_NOTIFICATION - * GUID_PNP_POWER_NOTIFICATION - * GUID_DEVICE_* (see above) - * - * EventCategory - * Type of the event that happened. - * - * Result - * ? - * - * Flags - * ? - * - * TotalSize - * Size of the event block including the device IDs and other - * per category specific fields. - */ -/* - * NtGetPlugPlayEvent - * - * Returns one Plug & Play event from a global queue. - * - * Parameters - * Reserved1 - * Reserved2 - * Always set to zero. - * - * Buffer - * The buffer that will be filled with the event information on - * successful return from the function. - * - * BufferSize - * Size of the buffer pointed by the Buffer parameter. If the - * buffer size is not large enough to hold the whole event - * information, error STATUS_BUFFER_TOO_SMALL is returned and - * the buffer remains untouched. - * - * Return Values - * STATUS_PRIVILEGE_NOT_HELD - * STATUS_BUFFER_TOO_SMALL - * STATUS_SUCCESS - * - * Remarks - * This function isn't multi-thread safe! - * - * @implemented - */ -NTSTATUS STDCALL -NtGetPlugPlayEvent(IN ULONG Reserved1, - IN ULONG Reserved2, - OUT PPLUGPLAY_EVENT_BLOCK Buffer, - IN ULONG BufferSize) -{ - PPNP_EVENT_ENTRY Entry; - NTSTATUS Status; - - DPRINT("NtGetPlugPlayEvent() called\n"); - - /* Function can only be called from user-mode */ - if (KeGetPreviousMode() == KernelMode) - { - DPRINT1("NtGetPlugPlayEvent cannot be called from kernel mode!\n"); - return STATUS_ACCESS_DENIED; - } - - /* Check for Tcb privilege */ - if (!SeSinglePrivilegeCheck(SeTcbPrivilege, - UserMode)) - { - DPRINT1("NtGetPlugPlayEvent: Caller does not hold the SeTcbPrivilege privilege!\n"); - return STATUS_PRIVILEGE_NOT_HELD; - } - - /* Wait for a PnP event */ - DPRINT("Waiting for pnp notification event\n"); - Status = KeWaitForSingleObject(&IopPnpNotifyEvent, - UserRequest, - KernelMode, - FALSE, - NULL); - if (!NT_SUCCESS(Status)) - { - DPRINT1("KeWaitForSingleObject() failed (Status %lx)\n", Status); - return Status; - } - - /* Get entry from the tail of the queue */ - Entry = CONTAINING_RECORD(IopPnpEventQueueHead.Blink, - PNP_EVENT_ENTRY, - ListEntry); - - /* Check the buffer size */ - if (BufferSize < Entry->Event.TotalSize) - { - DPRINT1("Buffer is too small for the pnp-event\n"); - return STATUS_BUFFER_TOO_SMALL; - } - - /* Copy event data to the user buffer */ - memcpy(Buffer, - &Entry->Event, - Entry->Event.TotalSize); - - DPRINT("NtGetPlugPlayEvent() done\n"); - - return STATUS_SUCCESS; -} - static PDEVICE_OBJECT IopTraverseDeviceNode(PDEVICE_NODE Node, PUNICODE_STRING DeviceInstance) @@ -706,6 +583,128 @@ return Status; } +/* PUBLIC FUNCTIONS **********************************************************/ + +/* + * Plug and Play event structure used by NtGetPlugPlayEvent. + * + * EventGuid + * Can be one of the following values: + * GUID_HWPROFILE_QUERY_CHANGE + * GUID_HWPROFILE_CHANGE_CANCELLED + * GUID_HWPROFILE_CHANGE_COMPLETE + * GUID_TARGET_DEVICE_QUERY_REMOVE + * GUID_TARGET_DEVICE_REMOVE_CANCELLED + * GUID_TARGET_DEVICE_REMOVE_COMPLETE + * GUID_PNP_CUSTOM_NOTIFICATION + * GUID_PNP_POWER_NOTIFICATION + * GUID_DEVICE_* (see above) + * + * EventCategory + * Type of the event that happened. + * + * Result + * ? + * + * Flags + * ? + * + * TotalSize + * Size of the event block including the device IDs and other + * per category specific fields. + */ + +/* + * NtGetPlugPlayEvent + * + * Returns one Plug & Play event from a global queue. + * + * Parameters + * Reserved1 + * Reserved2 + * Always set to zero. + * + * Buffer + * The buffer that will be filled with the event information on + * successful return from the function. + * + * BufferSize + * Size of the buffer pointed by the Buffer parameter. If the + * buffer size is not large enough to hold the whole event + * information, error STATUS_BUFFER_TOO_SMALL is returned and + * the buffer remains untouched. + * + * Return Values + * STATUS_PRIVILEGE_NOT_HELD + * STATUS_BUFFER_TOO_SMALL + * STATUS_SUCCESS + * + * Remarks + * This function isn't multi-thread safe! + * + * @implemented + */ +NTSTATUS +NTAPI +NtGetPlugPlayEvent(IN ULONG Reserved1, + IN ULONG Reserved2, + OUT PPLUGPLAY_EVENT_BLOCK Buffer, + IN ULONG BufferSize) +{ + PPNP_EVENT_ENTRY Entry; + NTSTATUS Status; + + DPRINT("NtGetPlugPlayEvent() called\n"); + + /* Function can only be called from user-mode */ + if (KeGetPreviousMode() == KernelMode) + { + DPRINT1("NtGetPlugPlayEvent cannot be called from kernel mode!\n"); + return STATUS_ACCESS_DENIED; + } + + /* Check for Tcb privilege */ + if (!SeSinglePrivilegeCheck(SeTcbPrivilege, + UserMode)) + { + DPRINT1("NtGetPlugPlayEvent: Caller does not hold the SeTcbPrivilege privilege!\n"); + return STATUS_PRIVILEGE_NOT_HELD; + } + + /* Wait for a PnP event */ + DPRINT("Waiting for pnp notification event\n"); + Status = KeWaitForSingleObject(&IopPnpNotifyEvent, + UserRequest, + KernelMode, + FALSE, + NULL); + if (!NT_SUCCESS(Status)) + { + DPRINT1("KeWaitForSingleObject() failed (Status %lx)\n", Status); + return Status; + } + + /* Get entry from the tail of the queue */ + Entry = CONTAINING_RECORD(IopPnpEventQueueHead.Blink, + PNP_EVENT_ENTRY, + ListEntry); + + /* Check the buffer size */ + if (BufferSize < Entry->Event.TotalSize) + { + DPRINT1("Buffer is too small for the pnp-event\n"); + return STATUS_BUFFER_TOO_SMALL; + } + + /* Copy event data to the user buffer */ + memcpy(Buffer, + &Entry->Event, + Entry->Event.TotalSize); + + DPRINT("NtGetPlugPlayEvent() done\n"); + + return STATUS_SUCCESS; +} /* * NtPlugPlayControl @@ -763,7 +762,8 @@ * * @unimplemented */ -NTSTATUS STDCALL +NTSTATUS +NTAPI NtPlugPlayControl(IN PLUGPLAY_CONTROL_CLASS PlugPlayControlClass, IN OUT PVOID Buffer, IN ULONG BufferLength) @@ -844,5 +844,3 @@ return STATUS_NOT_IMPLEMENTED; } - -/* EOF */ Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpdma.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpdma.…
============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnpdma.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpdma.c [iso-8859-1] Mon Aug 18 08:30:17 2008 @@ -1,9 +1,8 @@ /* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/pnpdma.c + * PROJECT: ReactOS Kernel + * COPYRIGHT: GPL - See COPYING in the top level directory + * FILE: ntoskrnl/io/pnpmgr/pnpdma.c * PURPOSE: PnP manager DMA routines - * * PROGRAMMERS: Filip Navara (xnavara(a)volny.cz) */ @@ -14,69 +13,74 @@ #include <internal/debug.h> #include <wdmguid.h> -/* FUNCTIONS *****************************************************************/ +/* PUBLIC FUNCTIONS **********************************************************/ /* * @implemented */ -PDMA_ADAPTER STDCALL -IoGetDmaAdapter( - IN PDEVICE_OBJECT PhysicalDeviceObject, - IN PDEVICE_DESCRIPTION DeviceDescription, - IN OUT PULONG NumberOfMapRegisters) +PDMA_ADAPTER +NTAPI +IoGetDmaAdapter(IN PDEVICE_OBJECT PhysicalDeviceObject, + IN PDEVICE_DESCRIPTION DeviceDescription, + IN OUT PULONG NumberOfMapRegisters) { - NTSTATUS Status; - ULONG ResultLength; - BUS_INTERFACE_STANDARD BusInterface; - IO_STATUS_BLOCK IoStatusBlock; - IO_STACK_LOCATION Stack; - DEVICE_DESCRIPTION PrivateDeviceDescription; - PDMA_ADAPTER Adapter = NULL; + NTSTATUS Status; + ULONG ResultLength; + BUS_INTERFACE_STANDARD BusInterface; + IO_STATUS_BLOCK IoStatusBlock; + IO_STACK_LOCATION Stack; + DEVICE_DESCRIPTION PrivateDeviceDescription; + PDMA_ADAPTER Adapter = NULL; - DPRINT("IoGetDmaAdapter called\n"); + DPRINT("IoGetDmaAdapter called\n"); - /* - * Try to create DMA adapter through bus driver. - */ - if (PhysicalDeviceObject != NULL) - { - if (DeviceDescription->InterfaceType == PNPBus || - DeviceDescription->InterfaceType == InterfaceTypeUndefined) + /* Try to create DMA adapter through bus driver */ + if (PhysicalDeviceObject) { - RtlCopyMemory(&PrivateDeviceDescription, DeviceDescription, - sizeof(DEVICE_DESCRIPTION)); - Status = IoGetDeviceProperty(PhysicalDeviceObject, - DevicePropertyLegacyBusType, sizeof(INTERFACE_TYPE), - &PrivateDeviceDescription.InterfaceType, &ResultLength); - if (!NT_SUCCESS(Status)) - PrivateDeviceDescription.InterfaceType = Internal; - DeviceDescription = &PrivateDeviceDescription; + if (DeviceDescription->InterfaceType == PNPBus || + DeviceDescription->InterfaceType == InterfaceTypeUndefined) + { + RtlCopyMemory(&PrivateDeviceDescription, + DeviceDescription, + sizeof(DEVICE_DESCRIPTION)); + + Status = IoGetDeviceProperty(PhysicalDeviceObject, + DevicePropertyLegacyBusType, + sizeof(INTERFACE_TYPE), + &PrivateDeviceDescription.InterfaceType, + &ResultLength); + + if (!NT_SUCCESS(Status)) + PrivateDeviceDescription.InterfaceType = Internal; + + DeviceDescription = &PrivateDeviceDescription; + } + + Stack.Parameters.QueryInterface.Size = sizeof(BUS_INTERFACE_STANDARD); + Stack.Parameters.QueryInterface.Version = 1; + Stack.Parameters.QueryInterface.Interface = (PINTERFACE)&BusInterface; + Stack.Parameters.QueryInterface.InterfaceType = + &GUID_BUS_INTERFACE_STANDARD; + + Status = IopInitiatePnpIrp(PhysicalDeviceObject, + &IoStatusBlock, + IRP_MN_QUERY_INTERFACE, + &Stack); + + if (NT_SUCCESS(Status)) + { + Adapter = BusInterface.GetDmaAdapter(BusInterface.Context, + DeviceDescription, + NumberOfMapRegisters); + + BusInterface.InterfaceDereference(BusInterface.Context); + if (Adapter) return Adapter; + } } - Stack.Parameters.QueryInterface.Size = sizeof(BUS_INTERFACE_STANDARD); - Stack.Parameters.QueryInterface.Version = 1; - Stack.Parameters.QueryInterface.Interface = (PINTERFACE)&BusInterface; - Stack.Parameters.QueryInterface.InterfaceType = - &GUID_BUS_INTERFACE_STANDARD; - Status = IopInitiatePnpIrp(PhysicalDeviceObject, &IoStatusBlock, - IRP_MN_QUERY_INTERFACE, &Stack); - if (NT_SUCCESS(Status)) - { - Adapter = BusInterface.GetDmaAdapter(BusInterface.Context, - DeviceDescription, NumberOfMapRegisters); - BusInterface.InterfaceDereference(BusInterface.Context); - if (Adapter != NULL) - return Adapter; - } - } - - /* - * Fallback to HAL. - */ - - return HalGetDmaAdapter(PhysicalDeviceObject, DeviceDescription, - NumberOfMapRegisters); + /* Fall back to HAL */ + return HalGetDmaAdapter(PhysicalDeviceObject, + DeviceDescription, + NumberOfMapRegisters); } - -/* EOF */ Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.…
============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] Mon Aug 18 08:30:17 2008 @@ -1,17 +1,15 @@ /* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/pnpmgr.c + * PROJECT: ReactOS Kernel + * COPYRIGHT: GPL - See COPYING in the top level directory + * FILE: ntoskrnl/io/pnpmgr/pnpmgr.c * PURPOSE: Initializes the PnP manager - * * PROGRAMMERS: Casper S. Hornstrup (chorns(a)users.sourceforge.net) - * Hervé Poussineau (hpoussin(a)reactos.org) + * Copyright 2007 Hervé Poussineau (hpoussin(a)reactos.org) */ /* INCLUDES ******************************************************************/ #include <ntoskrnl.h> - #define NDEBUG #include <internal/debug.h> @@ -224,7 +222,7 @@ } NTSTATUS -STDCALL +NTAPI IopQueryDeviceCapabilities(PDEVICE_NODE DeviceNode, PDEVICE_CAPABILITIES DeviceCaps) { @@ -265,466 +263,6 @@ ExFreePool(Data); } -/* - * @implemented - */ -VOID -NTAPI -IoInvalidateDeviceRelations( - IN PDEVICE_OBJECT DeviceObject, - IN DEVICE_RELATION_TYPE Type) -{ - PIO_WORKITEM WorkItem; - PINVALIDATE_DEVICE_RELATION_DATA Data; - - Data = ExAllocatePool(PagedPool, sizeof(INVALIDATE_DEVICE_RELATION_DATA)); - if (!Data) - return; - WorkItem = IoAllocateWorkItem(DeviceObject); - if (!WorkItem) - { - ExFreePool(Data); - return; - } - - ObReferenceObject(DeviceObject); - Data->DeviceObject = DeviceObject; - Data->Type = Type; - Data->WorkItem = WorkItem; - - IoQueueWorkItem( - WorkItem, - IopAsynchronousInvalidateDeviceRelations, - DelayedWorkQueue, - Data); -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, - IN DEVICE_REGISTRY_PROPERTY DeviceProperty, - IN ULONG BufferLength, - OUT PVOID PropertyBuffer, - OUT PULONG ResultLength) -{ - PDEVICE_NODE DeviceNode = IopGetDeviceNode(DeviceObject); - DEVICE_CAPABILITIES DeviceCaps; - ULONG Length; - PVOID Data = NULL; - PWSTR Ptr; - NTSTATUS Status; - - DPRINT("IoGetDeviceProperty(0x%p %d)\n", DeviceObject, DeviceProperty); - - *ResultLength = 0; - - if (DeviceNode == NULL) - return STATUS_INVALID_DEVICE_REQUEST; - - switch (DeviceProperty) - { - case DevicePropertyBusNumber: - Length = sizeof(ULONG); - Data = &DeviceNode->ChildBusNumber; - break; - - /* Complete, untested */ - case DevicePropertyBusTypeGuid: - /* Sanity check */ - if ((DeviceNode->ChildBusTypeIndex != 0xFFFF) && - (DeviceNode->ChildBusTypeIndex < IopBusTypeGuidList->GuidCount)) - { - /* Return the GUID */ - *ResultLength = sizeof(GUID); - - /* Check if the buffer given was large enough */ - if (BufferLength < *ResultLength) - { - return STATUS_BUFFER_TOO_SMALL; - } - - /* Copy the GUID */ - RtlCopyMemory(PropertyBuffer, - &(IopBusTypeGuidList->Guids[DeviceNode->ChildBusTypeIndex]), - sizeof(GUID)); - return STATUS_SUCCESS; - } - else - { - return STATUS_OBJECT_NAME_NOT_FOUND; - } - break; - - case DevicePropertyLegacyBusType: - Length = sizeof(INTERFACE_TYPE); - Data = &DeviceNode->ChildInterfaceType; - break; - - case DevicePropertyAddress: - /* Query the device caps */ - Status = IopQueryDeviceCapabilities(DeviceNode, &DeviceCaps); - if (NT_SUCCESS(Status) && (DeviceCaps.Address != (ULONG)-1)) - { - /* Return length */ - *ResultLength = sizeof(ULONG); - - /* Check if the buffer given was large enough */ - if (BufferLength < *ResultLength) - { - return STATUS_BUFFER_TOO_SMALL; - } - - /* Return address */ - *(PULONG)PropertyBuffer = DeviceCaps.Address; - return STATUS_SUCCESS; - } - else - { - return STATUS_OBJECT_NAME_NOT_FOUND; - } - break; - -// case DevicePropertyUINumber: -// if (DeviceNode->CapabilityFlags == NULL) -// return STATUS_INVALID_DEVICE_REQUEST; -// Length = sizeof(ULONG); -// Data = &DeviceNode->CapabilityFlags->UINumber; -// break; - - case DevicePropertyClassName: - case DevicePropertyClassGuid: - case DevicePropertyDriverKeyName: - case DevicePropertyManufacturer: - case DevicePropertyFriendlyName: - case DevicePropertyHardwareID: - case DevicePropertyCompatibleIDs: - case DevicePropertyDeviceDescription: - case DevicePropertyLocationInformation: - case DevicePropertyUINumber: - { - LPCWSTR RegistryPropertyName; - UNICODE_STRING EnumRoot = RTL_CONSTANT_STRING(ENUM_ROOT); - UNICODE_STRING ValueName; - KEY_VALUE_PARTIAL_INFORMATION *ValueInformation; - ULONG ValueInformationLength; - HANDLE KeyHandle, EnumRootHandle; - NTSTATUS Status; - - switch (DeviceProperty) - { - case DevicePropertyClassName: - RegistryPropertyName = L"Class"; break; - case DevicePropertyClassGuid: - RegistryPropertyName = L"ClassGuid"; break; - case DevicePropertyDriverKeyName: - RegistryPropertyName = L"Driver"; break; - case DevicePropertyManufacturer: - RegistryPropertyName = L"Mfg"; break; - case DevicePropertyFriendlyName: - RegistryPropertyName = L"FriendlyName"; break; - case DevicePropertyHardwareID: - RegistryPropertyName = L"HardwareID"; break; - case DevicePropertyCompatibleIDs: - RegistryPropertyName = L"CompatibleIDs"; break; - case DevicePropertyDeviceDescription: - RegistryPropertyName = L"DeviceDesc"; break; - case DevicePropertyLocationInformation: - RegistryPropertyName = L"LocationInformation"; break; - case DevicePropertyUINumber: - RegistryPropertyName = L"UINumber"; break; - default: - /* Should not happen */ - ASSERT(FALSE); - return STATUS_UNSUCCESSFUL; - } - - DPRINT("Registry property %S\n", RegistryPropertyName); - - /* Open Enum key */ - Status = IopOpenRegistryKeyEx(&EnumRootHandle, NULL, - &EnumRoot, KEY_READ); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Error opening ENUM_ROOT, Status=0x%08x\n", Status); - return Status; - } - - /* Open instance key */ - Status = IopOpenRegistryKeyEx(&KeyHandle, EnumRootHandle, - &DeviceNode->InstancePath, KEY_READ); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Error opening InstancePath, Status=0x%08x\n", Status); - ZwClose(EnumRootHandle); - return Status; - } - - /* Allocate buffer to read as much data as required by the caller */ - ValueInformationLength = FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, - Data[0]) + BufferLength; - ValueInformation = ExAllocatePool(PagedPool, ValueInformationLength); - if (!ValueInformation) - { - ZwClose(KeyHandle); - return STATUS_INSUFFICIENT_RESOURCES; - } - - /* Read the value */ - RtlInitUnicodeString(&ValueName, RegistryPropertyName); - Status = ZwQueryValueKey(KeyHandle, &ValueName, - KeyValuePartialInformation, ValueInformation, - ValueInformationLength, - &ValueInformationLength); - ZwClose(KeyHandle); - - /* Return data */ - *ResultLength = ValueInformation->DataLength; - - if (!NT_SUCCESS(Status)) - { - DPRINT1("Problem: Status=0x%08x, ResultLength = %d\n", Status, *ResultLength); - ExFreePool(ValueInformation); - if (Status == STATUS_BUFFER_OVERFLOW) - return STATUS_BUFFER_TOO_SMALL; - else - return Status; - } - - /* FIXME: Verify the value (NULL-terminated, correct format). */ - RtlCopyMemory(PropertyBuffer, ValueInformation->Data, - ValueInformation->DataLength); - ExFreePool(ValueInformation); - - return STATUS_SUCCESS; - } - - case DevicePropertyBootConfiguration: - Length = 0; - if (DeviceNode->BootResources->Count != 0) - { - Length = CM_RESOURCE_LIST_SIZE(DeviceNode->BootResources); - } - Data = &DeviceNode->BootResources; - break; - - /* FIXME: use a translated boot configuration instead */ - case DevicePropertyBootConfigurationTranslated: - Length = 0; - if (DeviceNode->BootResources->Count != 0) - { - Length = CM_RESOURCE_LIST_SIZE(DeviceNode->BootResources); - } - Data = &DeviceNode->BootResources; - break; - - case DevicePropertyEnumeratorName: - /* A buffer overflow can't happen here, since InstancePath - * always contains the enumerator name followed by \\ */ - Ptr = wcschr(DeviceNode->InstancePath.Buffer, L'\\'); - ASSERT(Ptr); - Length = (Ptr - DeviceNode->InstancePath.Buffer + 1) * sizeof(WCHAR); - Data = DeviceNode->InstancePath.Buffer; - break; - - case DevicePropertyPhysicalDeviceObjectName: - /* InstancePath buffer is NULL terminated, so we can do this */ - Length = DeviceNode->InstancePath.MaximumLength; - Data = DeviceNode->InstancePath.Buffer; - break; - - default: - return STATUS_INVALID_PARAMETER_2; - } - - /* Prepare returned values */ - *ResultLength = Length; - if (BufferLength < Length) - return STATUS_BUFFER_TOO_SMALL; - RtlCopyMemory(PropertyBuffer, Data, Length); - - /* NULL terminate the string (if required) */ - if (DeviceProperty == DevicePropertyEnumeratorName) - ((LPWSTR)PropertyBuffer)[Length / sizeof(WCHAR)] = UNICODE_NULL; - - return STATUS_SUCCESS; -} - -/* - * @unimplemented - */ -VOID -STDCALL -IoInvalidateDeviceState(IN PDEVICE_OBJECT PhysicalDeviceObject) -{ - UNIMPLEMENTED; -} - -/** - * @name IoOpenDeviceRegistryKey - * - * Open a registry key unique for a specified driver or device instance. - * - * @param DeviceObject Device to get the registry key for. - * @param DevInstKeyType Type of the key to return. - * @param DesiredAccess Access mask (eg. KEY_READ | KEY_WRITE). - * @param DevInstRegKey Handle to the opened registry key on - * successful return. - * - * @return Status. - * - * @implemented - */ -NTSTATUS -STDCALL -IoOpenDeviceRegistryKey(IN PDEVICE_OBJECT DeviceObject, - IN ULONG DevInstKeyType, - IN ACCESS_MASK DesiredAccess, - OUT PHANDLE DevInstRegKey) -{ - static WCHAR RootKeyName[] = - L"\\Registry\\Machine\\System\\CurrentControlSet\\"; - static WCHAR ProfileKeyName[] = - L"Hardware Profiles\\Current\\System\\CurrentControlSet\\"; - static WCHAR ClassKeyName[] = L"Control\\Class\\"; - static WCHAR EnumKeyName[] = L"Enum\\"; - static WCHAR DeviceParametersKeyName[] = L"Device Parameters"; - ULONG KeyNameLength; - LPWSTR KeyNameBuffer; - UNICODE_STRING KeyName; - ULONG DriverKeyLength; - OBJECT_ATTRIBUTES ObjectAttributes; - PDEVICE_NODE DeviceNode = NULL; - NTSTATUS Status; - - DPRINT("IoOpenDeviceRegistryKey() called\n"); - - if ((DevInstKeyType & (PLUGPLAY_REGKEY_DEVICE | PLUGPLAY_REGKEY_DRIVER)) == 0) - { - DPRINT1("IoOpenDeviceRegistryKey(): got wrong params, exiting... \n"); - return STATUS_INVALID_PARAMETER; - } - - /* - * Calculate the length of the base key name. This is the full - * name for driver key or the name excluding "Device Parameters" - * subkey for device key. - */ - - KeyNameLength = sizeof(RootKeyName); - if (DevInstKeyType & PLUGPLAY_REGKEY_CURRENT_HWPROFILE) - KeyNameLength += sizeof(ProfileKeyName) - sizeof(UNICODE_NULL); - if (DevInstKeyType & PLUGPLAY_REGKEY_DRIVER) - { - KeyNameLength += sizeof(ClassKeyName) - sizeof(UNICODE_NULL); - Status = IoGetDeviceProperty(DeviceObject, DevicePropertyDriverKeyName, - 0, NULL, &DriverKeyLength); - if (Status != STATUS_BUFFER_TOO_SMALL) - return Status; - KeyNameLength += DriverKeyLength; - } - else - { - DeviceNode = IopGetDeviceNode(DeviceObject); - KeyNameLength += sizeof(EnumKeyName) - sizeof(UNICODE_NULL) + - DeviceNode->InstancePath.Length; - } - - /* - * Now allocate the buffer for the key name... - */ - - KeyNameBuffer = ExAllocatePool(PagedPool, KeyNameLength); - if (KeyNameBuffer == NULL) - return STATUS_INSUFFICIENT_RESOURCES; - - KeyName.Length = 0; - KeyName.MaximumLength = (USHORT)KeyNameLength; - KeyName.Buffer = KeyNameBuffer; - - /* - * ...and build the key name. - */ - - KeyName.Length += sizeof(RootKeyName) - sizeof(UNICODE_NULL); - RtlCopyMemory(KeyNameBuffer, RootKeyName, KeyName.Length); - - if (DevInstKeyType & PLUGPLAY_REGKEY_CURRENT_HWPROFILE) - RtlAppendUnicodeToString(&KeyName, ProfileKeyName); - - if (DevInstKeyType & PLUGPLAY_REGKEY_DRIVER) - { - RtlAppendUnicodeToString(&KeyName, ClassKeyName); - Status = IoGetDeviceProperty(DeviceObject, DevicePropertyDriverKeyName, - DriverKeyLength, KeyNameBuffer + - (KeyName.Length / sizeof(WCHAR)), - &DriverKeyLength); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Call to IoGetDeviceProperty() failed with Status 0x%08lx\n", Status); - ExFreePool(KeyNameBuffer); - return Status; - } - KeyName.Length += (USHORT)DriverKeyLength - sizeof(UNICODE_NULL); - } - else - { - RtlAppendUnicodeToString(&KeyName, EnumKeyName); - Status = RtlAppendUnicodeStringToString(&KeyName, &DeviceNode->InstancePath); - if (DeviceNode->InstancePath.Length == 0) - { - ExFreePool(KeyNameBuffer); - return Status; - } - } - - /* - * Open the base key. - */ - Status = IopOpenRegistryKeyEx(DevInstRegKey, NULL, &KeyName, DesiredAccess); - if (!NT_SUCCESS(Status)) - { - DPRINT1("IoOpenDeviceRegistryKey(%wZ): Base key doesn't exist, exiting... (Status 0x%08lx)\n", &KeyName, Status); - ExFreePool(KeyNameBuffer); - return Status; - } - ExFreePool(KeyNameBuffer); - - /* - * For driver key we're done now. - */ - - if (DevInstKeyType & PLUGPLAY_REGKEY_DRIVER) - return Status; - - /* - * Let's go further. For device key we must open "Device Parameters" - * subkey and create it if it doesn't exist yet. - */ - - RtlInitUnicodeString(&KeyName, DeviceParametersKeyName); - InitializeObjectAttributes(&ObjectAttributes, &KeyName, - OBJ_CASE_INSENSITIVE, *DevInstRegKey, NULL); - Status = ZwCreateKey(DevInstRegKey, DesiredAccess, &ObjectAttributes, - 0, NULL, REG_OPTION_NON_VOLATILE, NULL); - ZwClose(ObjectAttributes.RootDirectory); - - return Status; -} - -/* - * @unimplemented - */ -VOID -STDCALL -IoRequestDeviceEject(IN PDEVICE_OBJECT PhysicalDeviceObject) -{ - UNIMPLEMENTED; -} - - NTSTATUS IopGetSystemPowerDeviceObject(PDEVICE_OBJECT *DeviceObject) { @@ -743,7 +281,7 @@ } USHORT -STDCALL +NTAPI IopGetBusTypeGuidIndex(LPGUID BusTypeGuid) { USHORT i = 0, FoundIndex = 0xFFFF; @@ -2137,158 +1675,6 @@ } /* - * @implemented - */ -VOID -NTAPI -IoSynchronousInvalidateDeviceRelations( - IN PDEVICE_OBJECT DeviceObject, - IN DEVICE_RELATION_TYPE Type) -{ - PDEVICE_NODE DeviceNode = IopGetDeviceNode(DeviceObject); - DEVICETREE_TRAVERSE_CONTEXT Context; - PDEVICE_RELATIONS DeviceRelations; - IO_STATUS_BLOCK IoStatusBlock; - PDEVICE_NODE ChildDeviceNode; - IO_STACK_LOCATION Stack; - BOOLEAN BootDrivers; - OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING LinkName = RTL_CONSTANT_STRING(L"\\SystemRoot"); - HANDLE Handle; - NTSTATUS Status; - ULONG i; - - DPRINT("DeviceObject 0x%p\n", DeviceObject); - - DPRINT("Sending IRP_MN_QUERY_DEVICE_RELATIONS to device stack\n"); - - Stack.Parameters.QueryDeviceRelations.Type = Type; - - Status = IopInitiatePnpIrp( - DeviceObject, - &IoStatusBlock, - IRP_MN_QUERY_DEVICE_RELATIONS, - &Stack); - if (!NT_SUCCESS(Status)) - { - DPRINT("IopInitiatePnpIrp() failed with status 0x%08lx\n", Status); - return; - } - - DeviceRelations = (PDEVICE_RELATIONS)IoStatusBlock.Information; - - if (!DeviceRelations || DeviceRelations->Count <= 0) - { - DPRINT("No PDOs\n"); - if (DeviceRelations) - { - ExFreePool(DeviceRelations); - } - return; - } - - DPRINT("Got %d PDOs\n", DeviceRelations->Count); - - /* - * Create device nodes for all discovered devices - */ - for (i = 0; i < DeviceRelations->Count; i++) - { - if (IopGetDeviceNode(DeviceRelations->Objects[i]) != NULL) - { - ObDereferenceObject(DeviceRelations->Objects[i]); - continue; - } - Status = IopCreateDeviceNode( - DeviceNode, - DeviceRelations->Objects[i], - NULL, - &ChildDeviceNode); - DeviceNode->Flags |= DNF_ENUMERATED; - if (!NT_SUCCESS(Status)) - { - DPRINT("No resources\n"); - for (i = 0; i < DeviceRelations->Count; i++) - ObDereferenceObject(DeviceRelations->Objects[i]); - ExFreePool(DeviceRelations); - return; - } - } - ExFreePool(DeviceRelations); - - /* - * Retrieve information about all discovered children from the bus driver - */ - IopInitDeviceTreeTraverseContext( - &Context, - DeviceNode, - IopActionInterrogateDeviceStack, - DeviceNode); - - Status = IopTraverseDeviceTree(&Context); - if (!NT_SUCCESS(Status)) - { - DPRINT("IopTraverseDeviceTree() failed with status 0x%08lx\n", Status); - return; - } - - /* - * Retrieve configuration from the registry for discovered children - */ - IopInitDeviceTreeTraverseContext( - &Context, - DeviceNode, - IopActionConfigureChildServices, - DeviceNode); - - Status = IopTraverseDeviceTree(&Context); - if (!NT_SUCCESS(Status)) - { - DPRINT("IopTraverseDeviceTree() failed with status 0x%08lx\n", Status); - return; - } - - /* - * Get the state of the system boot. If the \\SystemRoot link isn't - * created yet, we will assume that it's possible to load only boot - * drivers. - */ - InitializeObjectAttributes( - &ObjectAttributes, - &LinkName, - 0, - NULL, - NULL); - Status = ZwOpenFile( - &Handle, - FILE_ALL_ACCESS, - &ObjectAttributes, - &IoStatusBlock, - 0, - 0); - if (NT_SUCCESS(Status)) - { - BootDrivers = FALSE; - ZwClose(Handle); - } - else - BootDrivers = TRUE; - - /* - * Initialize services for discovered children. Only boot drivers will - * be loaded from boot driver! - */ - Status = IopInitializePnpServices(DeviceNode, BootDrivers); - if (!NT_SUCCESS(Status)) - { - DPRINT("IopInitializePnpServices() failed with status 0x%08lx\n", Status); - return; - } - - DPRINT("IopInvalidateDeviceRelations() finished\n"); -} - -/* * IopActionConfigureChildServices * * Retrieve configuration for all (direct) child nodes of a parent node. @@ -3476,4 +2862,615 @@ } } -/* EOF */ +/* PUBLIC FUNCTIONS **********************************************************/ + +/* + * @unimplemented + */ +NTSTATUS +NTAPI +IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, + IN DEVICE_REGISTRY_PROPERTY DeviceProperty, + IN ULONG BufferLength, + OUT PVOID PropertyBuffer, + OUT PULONG ResultLength) +{ + PDEVICE_NODE DeviceNode = IopGetDeviceNode(DeviceObject); + DEVICE_CAPABILITIES DeviceCaps; + ULONG Length; + PVOID Data = NULL; + PWSTR Ptr; + NTSTATUS Status; + + DPRINT("IoGetDeviceProperty(0x%p %d)\n", DeviceObject, DeviceProperty); + + *ResultLength = 0; + + if (DeviceNode == NULL) + return STATUS_INVALID_DEVICE_REQUEST; + + switch (DeviceProperty) + { + case DevicePropertyBusNumber: + Length = sizeof(ULONG); + Data = &DeviceNode->ChildBusNumber; + break; + + /* Complete, untested */ + case DevicePropertyBusTypeGuid: + /* Sanity check */ + if ((DeviceNode->ChildBusTypeIndex != 0xFFFF) && + (DeviceNode->ChildBusTypeIndex < IopBusTypeGuidList->GuidCount)) + { + /* Return the GUID */ + *ResultLength = sizeof(GUID); + + /* Check if the buffer given was large enough */ + if (BufferLength < *ResultLength) + { + return STATUS_BUFFER_TOO_SMALL; + } + + /* Copy the GUID */ + RtlCopyMemory(PropertyBuffer, + &(IopBusTypeGuidList->Guids[DeviceNode->ChildBusTypeIndex]), + sizeof(GUID)); + return STATUS_SUCCESS; + } + else + { + return STATUS_OBJECT_NAME_NOT_FOUND; + } + break; + + case DevicePropertyLegacyBusType: + Length = sizeof(INTERFACE_TYPE); + Data = &DeviceNode->ChildInterfaceType; + break; + + case DevicePropertyAddress: + /* Query the device caps */ + Status = IopQueryDeviceCapabilities(DeviceNode, &DeviceCaps); + if (NT_SUCCESS(Status) && (DeviceCaps.Address != (ULONG)-1)) + { + /* Return length */ + *ResultLength = sizeof(ULONG); + + /* Check if the buffer given was large enough */ + if (BufferLength < *ResultLength) + { + return STATUS_BUFFER_TOO_SMALL; + } + + /* Return address */ + *(PULONG)PropertyBuffer = DeviceCaps.Address; + return STATUS_SUCCESS; + } + else + { + return STATUS_OBJECT_NAME_NOT_FOUND; + } + break; + +// case DevicePropertyUINumber: +// if (DeviceNode->CapabilityFlags == NULL) +// return STATUS_INVALID_DEVICE_REQUEST; +// Length = sizeof(ULONG); +// Data = &DeviceNode->CapabilityFlags->UINumber; +// break; + + case DevicePropertyClassName: + case DevicePropertyClassGuid: + case DevicePropertyDriverKeyName: + case DevicePropertyManufacturer: + case DevicePropertyFriendlyName: + case DevicePropertyHardwareID: + case DevicePropertyCompatibleIDs: + case DevicePropertyDeviceDescription: + case DevicePropertyLocationInformation: + case DevicePropertyUINumber: + { + LPCWSTR RegistryPropertyName; + UNICODE_STRING EnumRoot = RTL_CONSTANT_STRING(ENUM_ROOT); + UNICODE_STRING ValueName; + KEY_VALUE_PARTIAL_INFORMATION *ValueInformation; + ULONG ValueInformationLength; + HANDLE KeyHandle, EnumRootHandle; + NTSTATUS Status; + + switch (DeviceProperty) + { + case DevicePropertyClassName: + RegistryPropertyName = L"Class"; break; + case DevicePropertyClassGuid: + RegistryPropertyName = L"ClassGuid"; break; + case DevicePropertyDriverKeyName: + RegistryPropertyName = L"Driver"; break; + case DevicePropertyManufacturer: + RegistryPropertyName = L"Mfg"; break; + case DevicePropertyFriendlyName: + RegistryPropertyName = L"FriendlyName"; break; + case DevicePropertyHardwareID: + RegistryPropertyName = L"HardwareID"; break; + case DevicePropertyCompatibleIDs: + RegistryPropertyName = L"CompatibleIDs"; break; + case DevicePropertyDeviceDescription: + RegistryPropertyName = L"DeviceDesc"; break; + case DevicePropertyLocationInformation: + RegistryPropertyName = L"LocationInformation"; break; + case DevicePropertyUINumber: + RegistryPropertyName = L"UINumber"; break; + default: + /* Should not happen */ + ASSERT(FALSE); + return STATUS_UNSUCCESSFUL; + } + + DPRINT("Registry property %S\n", RegistryPropertyName); + + /* Open Enum key */ + Status = IopOpenRegistryKeyEx(&EnumRootHandle, NULL, + &EnumRoot, KEY_READ); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Error opening ENUM_ROOT, Status=0x%08x\n", Status); + return Status; + } + + /* Open instance key */ + Status = IopOpenRegistryKeyEx(&KeyHandle, EnumRootHandle, + &DeviceNode->InstancePath, KEY_READ); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Error opening InstancePath, Status=0x%08x\n", Status); + ZwClose(EnumRootHandle); + return Status; + } + + /* Allocate buffer to read as much data as required by the caller */ + ValueInformationLength = FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, + Data[0]) + BufferLength; + ValueInformation = ExAllocatePool(PagedPool, ValueInformationLength); + if (!ValueInformation) + { + ZwClose(KeyHandle); + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* Read the value */ + RtlInitUnicodeString(&ValueName, RegistryPropertyName); + Status = ZwQueryValueKey(KeyHandle, &ValueName, + KeyValuePartialInformation, ValueInformation, + ValueInformationLength, + &ValueInformationLength); + ZwClose(KeyHandle); + + /* Return data */ + *ResultLength = ValueInformation->DataLength; + + if (!NT_SUCCESS(Status)) + { + DPRINT1("Problem: Status=0x%08x, ResultLength = %d\n", Status, *ResultLength); + ExFreePool(ValueInformation); + if (Status == STATUS_BUFFER_OVERFLOW) + return STATUS_BUFFER_TOO_SMALL; + else + return Status; + } + + /* FIXME: Verify the value (NULL-terminated, correct format). */ + RtlCopyMemory(PropertyBuffer, ValueInformation->Data, + ValueInformation->DataLength); + ExFreePool(ValueInformation); + + return STATUS_SUCCESS; + } + + case DevicePropertyBootConfiguration: + Length = 0; + if (DeviceNode->BootResources->Count != 0) + { + Length = CM_RESOURCE_LIST_SIZE(DeviceNode->BootResources); + } + Data = &DeviceNode->BootResources; + break; + + /* FIXME: use a translated boot configuration instead */ + case DevicePropertyBootConfigurationTranslated: + Length = 0; + if (DeviceNode->BootResources->Count != 0) + { + Length = CM_RESOURCE_LIST_SIZE(DeviceNode->BootResources); + } + Data = &DeviceNode->BootResources; + break; + + case DevicePropertyEnumeratorName: + /* A buffer overflow can't happen here, since InstancePath + * always contains the enumerator name followed by \\ */ + Ptr = wcschr(DeviceNode->InstancePath.Buffer, L'\\'); + ASSERT(Ptr); + Length = (Ptr - DeviceNode->InstancePath.Buffer + 1) * sizeof(WCHAR); + Data = DeviceNode->InstancePath.Buffer; + break; + + case DevicePropertyPhysicalDeviceObjectName: + /* InstancePath buffer is NULL terminated, so we can do this */ + Length = DeviceNode->InstancePath.MaximumLength; + Data = DeviceNode->InstancePath.Buffer; + break; + + default: + return STATUS_INVALID_PARAMETER_2; + } + + /* Prepare returned values */ + *ResultLength = Length; + if (BufferLength < Length) + return STATUS_BUFFER_TOO_SMALL; + RtlCopyMemory(PropertyBuffer, Data, Length); + + /* NULL terminate the string (if required) */ + if (DeviceProperty == DevicePropertyEnumeratorName) + ((LPWSTR)PropertyBuffer)[Length / sizeof(WCHAR)] = UNICODE_NULL; + + return STATUS_SUCCESS; +} + +/* + * @unimplemented + */ +VOID +NTAPI +IoInvalidateDeviceState(IN PDEVICE_OBJECT PhysicalDeviceObject) +{ + UNIMPLEMENTED; +} + +/** + * @name IoOpenDeviceRegistryKey + * + * Open a registry key unique for a specified driver or device instance. + * + * @param DeviceObject Device to get the registry key for. + * @param DevInstKeyType Type of the key to return. + * @param DesiredAccess Access mask (eg. KEY_READ | KEY_WRITE). + * @param DevInstRegKey Handle to the opened registry key on + * successful return. + * + * @return Status. + * + * @implemented + */ +NTSTATUS +NTAPI +IoOpenDeviceRegistryKey(IN PDEVICE_OBJECT DeviceObject, + IN ULONG DevInstKeyType, + IN ACCESS_MASK DesiredAccess, + OUT PHANDLE DevInstRegKey) +{ + static WCHAR RootKeyName[] = + L"\\Registry\\Machine\\System\\CurrentControlSet\\"; + static WCHAR ProfileKeyName[] = + L"Hardware Profiles\\Current\\System\\CurrentControlSet\\"; + static WCHAR ClassKeyName[] = L"Control\\Class\\"; + static WCHAR EnumKeyName[] = L"Enum\\"; + static WCHAR DeviceParametersKeyName[] = L"Device Parameters"; + ULONG KeyNameLength; + LPWSTR KeyNameBuffer; + UNICODE_STRING KeyName; + ULONG DriverKeyLength; + OBJECT_ATTRIBUTES ObjectAttributes; + PDEVICE_NODE DeviceNode = NULL; + NTSTATUS Status; + + DPRINT("IoOpenDeviceRegistryKey() called\n"); + + if ((DevInstKeyType & (PLUGPLAY_REGKEY_DEVICE | PLUGPLAY_REGKEY_DRIVER)) == 0) + { + DPRINT1("IoOpenDeviceRegistryKey(): got wrong params, exiting... \n"); + return STATUS_INVALID_PARAMETER; + } + + /* + * Calculate the length of the base key name. This is the full + * name for driver key or the name excluding "Device Parameters" + * subkey for device key. + */ + + KeyNameLength = sizeof(RootKeyName); + if (DevInstKeyType & PLUGPLAY_REGKEY_CURRENT_HWPROFILE) + KeyNameLength += sizeof(ProfileKeyName) - sizeof(UNICODE_NULL); + if (DevInstKeyType & PLUGPLAY_REGKEY_DRIVER) + { + KeyNameLength += sizeof(ClassKeyName) - sizeof(UNICODE_NULL); + Status = IoGetDeviceProperty(DeviceObject, DevicePropertyDriverKeyName, + 0, NULL, &DriverKeyLength); + if (Status != STATUS_BUFFER_TOO_SMALL) + return Status; + KeyNameLength += DriverKeyLength; + } + else + { + DeviceNode = IopGetDeviceNode(DeviceObject); + KeyNameLength += sizeof(EnumKeyName) - sizeof(UNICODE_NULL) + + DeviceNode->InstancePath.Length; + } + + /* + * Now allocate the buffer for the key name... + */ + + KeyNameBuffer = ExAllocatePool(PagedPool, KeyNameLength); + if (KeyNameBuffer == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + + KeyName.Length = 0; + KeyName.MaximumLength = (USHORT)KeyNameLength; + KeyName.Buffer = KeyNameBuffer; + + /* + * ...and build the key name. + */ + + KeyName.Length += sizeof(RootKeyName) - sizeof(UNICODE_NULL); + RtlCopyMemory(KeyNameBuffer, RootKeyName, KeyName.Length); + + if (DevInstKeyType & PLUGPLAY_REGKEY_CURRENT_HWPROFILE) + RtlAppendUnicodeToString(&KeyName, ProfileKeyName); + + if (DevInstKeyType & PLUGPLAY_REGKEY_DRIVER) + { + RtlAppendUnicodeToString(&KeyName, ClassKeyName); + Status = IoGetDeviceProperty(DeviceObject, DevicePropertyDriverKeyName, + DriverKeyLength, KeyNameBuffer + + (KeyName.Length / sizeof(WCHAR)), + &DriverKeyLength); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Call to IoGetDeviceProperty() failed with Status 0x%08lx\n", Status); + ExFreePool(KeyNameBuffer); + return Status; + } + KeyName.Length += (USHORT)DriverKeyLength - sizeof(UNICODE_NULL); + } + else + { + RtlAppendUnicodeToString(&KeyName, EnumKeyName); + Status = RtlAppendUnicodeStringToString(&KeyName, &DeviceNode->InstancePath); + if (DeviceNode->InstancePath.Length == 0) + { + ExFreePool(KeyNameBuffer); + return Status; + } + } + + /* + * Open the base key. + */ + Status = IopOpenRegistryKeyEx(DevInstRegKey, NULL, &KeyName, DesiredAccess); + if (!NT_SUCCESS(Status)) + { + DPRINT1("IoOpenDeviceRegistryKey(%wZ): Base key doesn't exist, exiting... (Status 0x%08lx)\n", &KeyName, Status); + ExFreePool(KeyNameBuffer); + return Status; + } + ExFreePool(KeyNameBuffer); + + /* + * For driver key we're done now. + */ + + if (DevInstKeyType & PLUGPLAY_REGKEY_DRIVER) + return Status; + + /* + * Let's go further. For device key we must open "Device Parameters" + * subkey and create it if it doesn't exist yet. + */ + + RtlInitUnicodeString(&KeyName, DeviceParametersKeyName); + InitializeObjectAttributes(&ObjectAttributes, &KeyName, + OBJ_CASE_INSENSITIVE, *DevInstRegKey, NULL); + Status = ZwCreateKey(DevInstRegKey, DesiredAccess, &ObjectAttributes, + 0, NULL, REG_OPTION_NON_VOLATILE, NULL); + ZwClose(ObjectAttributes.RootDirectory); + + return Status; +} + +/* + * @unimplemented + */ +VOID +NTAPI +IoRequestDeviceEject(IN PDEVICE_OBJECT PhysicalDeviceObject) +{ + UNIMPLEMENTED; +} + +/* + * @implemented + */ +VOID +NTAPI +IoInvalidateDeviceRelations( + IN PDEVICE_OBJECT DeviceObject, + IN DEVICE_RELATION_TYPE Type) +{ + PIO_WORKITEM WorkItem; + PINVALIDATE_DEVICE_RELATION_DATA Data; + + Data = ExAllocatePool(PagedPool, sizeof(INVALIDATE_DEVICE_RELATION_DATA)); + if (!Data) + return; + WorkItem = IoAllocateWorkItem(DeviceObject); + if (!WorkItem) + { + ExFreePool(Data); + return; + } + + ObReferenceObject(DeviceObject); + Data->DeviceObject = DeviceObject; + Data->Type = Type; + Data->WorkItem = WorkItem; + + IoQueueWorkItem( + WorkItem, + IopAsynchronousInvalidateDeviceRelations, + DelayedWorkQueue, + Data); +} + +/* + * @implemented + */ +VOID +NTAPI +IoSynchronousInvalidateDeviceRelations( + IN PDEVICE_OBJECT DeviceObject, + IN DEVICE_RELATION_TYPE Type) +{ + PDEVICE_NODE DeviceNode = IopGetDeviceNode(DeviceObject); + DEVICETREE_TRAVERSE_CONTEXT Context; + PDEVICE_RELATIONS DeviceRelations; + IO_STATUS_BLOCK IoStatusBlock; + PDEVICE_NODE ChildDeviceNode; + IO_STACK_LOCATION Stack; + BOOLEAN BootDrivers; + OBJECT_ATTRIBUTES ObjectAttributes; + UNICODE_STRING LinkName = RTL_CONSTANT_STRING(L"\\SystemRoot"); + HANDLE Handle; + NTSTATUS Status; + ULONG i; + + DPRINT("DeviceObject 0x%p\n", DeviceObject); + + DPRINT("Sending IRP_MN_QUERY_DEVICE_RELATIONS to device stack\n"); + + Stack.Parameters.QueryDeviceRelations.Type = Type; + + Status = IopInitiatePnpIrp( + DeviceObject, + &IoStatusBlock, + IRP_MN_QUERY_DEVICE_RELATIONS, + &Stack); + if (!NT_SUCCESS(Status)) + { + DPRINT("IopInitiatePnpIrp() failed with status 0x%08lx\n", Status); + return; + } + + DeviceRelations = (PDEVICE_RELATIONS)IoStatusBlock.Information; + + if (!DeviceRelations || DeviceRelations->Count <= 0) + { + DPRINT("No PDOs\n"); + if (DeviceRelations) + { + ExFreePool(DeviceRelations); + } + return; + } + + DPRINT("Got %d PDOs\n", DeviceRelations->Count); + + /* + * Create device nodes for all discovered devices + */ + for (i = 0; i < DeviceRelations->Count; i++) + { + if (IopGetDeviceNode(DeviceRelations->Objects[i]) != NULL) + { + ObDereferenceObject(DeviceRelations->Objects[i]); + continue; + } + Status = IopCreateDeviceNode( + DeviceNode, + DeviceRelations->Objects[i], + NULL, + &ChildDeviceNode); + DeviceNode->Flags |= DNF_ENUMERATED; + if (!NT_SUCCESS(Status)) + { + DPRINT("No resources\n"); + for (i = 0; i < DeviceRelations->Count; i++) + ObDereferenceObject(DeviceRelations->Objects[i]); + ExFreePool(DeviceRelations); + return; + } + } + ExFreePool(DeviceRelations); + + /* + * Retrieve information about all discovered children from the bus driver + */ + IopInitDeviceTreeTraverseContext( + &Context, + DeviceNode, + IopActionInterrogateDeviceStack, + DeviceNode); + + Status = IopTraverseDeviceTree(&Context); + if (!NT_SUCCESS(Status)) + { + DPRINT("IopTraverseDeviceTree() failed with status 0x%08lx\n", Status); + return; + } + + /* + * Retrieve configuration from the registry for discovered children + */ + IopInitDeviceTreeTraverseContext( + &Context, + DeviceNode, + IopActionConfigureChildServices, + DeviceNode); + + Status = IopTraverseDeviceTree(&Context); + if (!NT_SUCCESS(Status)) + { + DPRINT("IopTraverseDeviceTree() failed with status 0x%08lx\n", Status); + return; + } + + /* + * Get the state of the system boot. If the \\SystemRoot link isn't + * created yet, we will assume that it's possible to load only boot + * drivers. + */ + InitializeObjectAttributes( + &ObjectAttributes, + &LinkName, + 0, + NULL, + NULL); + Status = ZwOpenFile( + &Handle, + FILE_ALL_ACCESS, + &ObjectAttributes, + &IoStatusBlock, + 0, + 0); + if (NT_SUCCESS(Status)) + { + BootDrivers = FALSE; + ZwClose(Handle); + } + else + BootDrivers = TRUE; + + /* + * Initialize services for discovered children. Only boot drivers will + * be loaded from boot driver! + */ + Status = IopInitializePnpServices(DeviceNode, BootDrivers); + if (!NT_SUCCESS(Status)) + { + DPRINT("IopInitializePnpServices() failed with status 0x%08lx\n", Status); + return; + } + + DPRINT("IopInvalidateDeviceRelations() finished\n"); +} Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpnotify.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpnoti…
============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnpnotify.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpnotify.c [iso-8859-1] Mon Aug 18 08:30:17 2008 @@ -1,9 +1,8 @@ /* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/pnpnotify.c + * PROJECT: ReactOS Kernel + * COPYRIGHT: GPL - See COPYING in the top level directory + * FILE: ntoskrnl/io/pnpmgr/pnpnotify.c * PURPOSE: Plug & Play notification functions - * * PROGRAMMERS: Filip Navara (xnavara(a)volny.cz) * Hervé Poussineau (hpoussin(a)reactos.org) */ @@ -14,184 +13,22 @@ #define NDEBUG #include <debug.h> -#if defined (ALLOC_PRAGMA) -#pragma alloc_text(INIT, IopInitPnpNotificationImplementation) -#endif - - /* TYPES *******************************************************************/ typedef struct _PNP_NOTIFY_ENTRY { - LIST_ENTRY PnpNotifyList; - IO_NOTIFICATION_EVENT_CATEGORY EventCategory; - PVOID Context; - UNICODE_STRING Guid; - PFILE_OBJECT FileObject; - PDRIVER_NOTIFICATION_CALLBACK_ROUTINE PnpNotificationProc; + LIST_ENTRY PnpNotifyList; + IO_NOTIFICATION_EVENT_CATEGORY EventCategory; + PVOID Context; + UNICODE_STRING Guid; + PFILE_OBJECT FileObject; + PDRIVER_NOTIFICATION_CALLBACK_ROUTINE PnpNotificationProc; } PNP_NOTIFY_ENTRY, *PPNP_NOTIFY_ENTRY; KGUARDED_MUTEX PnpNotifyListLock; LIST_ENTRY PnpNotifyListHead; /* FUNCTIONS *****************************************************************/ - -/* - * @unimplemented - */ -ULONG -STDCALL -IoPnPDeliverServicePowerNotification( - ULONG VetoedPowerOperation OPTIONAL, - ULONG PowerNotification, - ULONG Unknown OPTIONAL, - BOOLEAN Synchronous - ) -{ - UNIMPLEMENTED; - return 0; -} - -/* - * @implemented - */ -NTSTATUS -STDCALL -IoRegisterPlugPlayNotification( - IN IO_NOTIFICATION_EVENT_CATEGORY EventCategory, - IN ULONG EventCategoryFlags, - IN PVOID EventCategoryData OPTIONAL, - IN PDRIVER_OBJECT DriverObject, - IN PDRIVER_NOTIFICATION_CALLBACK_ROUTINE CallbackRoutine, - IN PVOID Context, - OUT PVOID *NotificationEntry) -{ - PPNP_NOTIFY_ENTRY Entry; - PWSTR SymbolicLinkList; - NTSTATUS Status; - - PAGED_CODE(); - - DPRINT("IoRegisterPlugPlayNotification(EventCategory 0x%x, EventCategoryFlags 0x%lx, DriverObject %p) called.\n", - EventCategory, - EventCategoryFlags, - DriverObject); - - ObReferenceObject(DriverObject); - - /* Try to allocate entry for notification before sending any notification */ - Entry = ExAllocatePoolWithTag( - NonPagedPool, - sizeof(PNP_NOTIFY_ENTRY), - TAG_PNP_NOTIFY); - if (!Entry) - { - DPRINT("ExAllocatePool() failed\n"); - ObDereferenceObject(DriverObject); - return STATUS_INSUFFICIENT_RESOURCES; - } - - if (EventCategory == EventCategoryDeviceInterfaceChange - && EventCategoryFlags & PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES) - { - DEVICE_INTERFACE_CHANGE_NOTIFICATION NotificationInfos; - UNICODE_STRING SymbolicLinkU; - PWSTR SymbolicLink; - - Status = IoGetDeviceInterfaces( - (LPGUID)EventCategoryData, - NULL, /* PhysicalDeviceObject OPTIONAL */ - 0, /* Flags */ - &SymbolicLinkList); - if (!NT_SUCCESS(Status)) - { - DPRINT("IoGetDeviceInterfaces() failed with status 0x%08lx\n", Status); - ExFreePoolWithTag(Entry, TAG_PNP_NOTIFY); - ObDereferenceObject(DriverObject); - return Status; - } - /* Enumerate SymbolicLinkList */ - NotificationInfos.Version = 1; - NotificationInfos.Size = sizeof(DEVICE_INTERFACE_CHANGE_NOTIFICATION); - RtlCopyMemory(&NotificationInfos.Event, &GUID_DEVICE_INTERFACE_ARRIVAL, sizeof(GUID)); - RtlCopyMemory(&NotificationInfos.InterfaceClassGuid, EventCategoryData, sizeof(GUID)); - NotificationInfos.SymbolicLinkName = &SymbolicLinkU; - for (SymbolicLink = SymbolicLinkList; *SymbolicLink; SymbolicLink += wcslen(SymbolicLink) + 1) - { - RtlInitUnicodeString(&SymbolicLinkU, SymbolicLink); - DPRINT("Calling callback routine for %S\n", SymbolicLink); - (*CallbackRoutine)(&NotificationInfos, Context); - } - ExFreePool(SymbolicLinkList); - } - - Entry->PnpNotificationProc = CallbackRoutine; - Entry->EventCategory = EventCategory; - Entry->Context = Context; - switch (EventCategory) - { - case EventCategoryDeviceInterfaceChange: - { - Status = RtlStringFromGUID(EventCategoryData, &Entry->Guid); - if (!NT_SUCCESS(Status)) - { - ExFreePoolWithTag(Entry, TAG_PNP_NOTIFY); - ObDereferenceObject(DriverObject); - return Status; - } - break; - } - case EventCategoryHardwareProfileChange: - { - /* nothing to do */ - break; - } - case EventCategoryTargetDeviceChange: - { - Entry->FileObject = (PFILE_OBJECT)EventCategoryData; - break; - } - default: - { - DPRINT1("IoRegisterPlugPlayNotification(): unknown EventCategory 0x%x UNIMPLEMENTED\n", EventCategory); - break; - } - } - - KeAcquireGuardedMutex(&PnpNotifyListLock); - InsertHeadList(&PnpNotifyListHead, - &Entry->PnpNotifyList); - KeReleaseGuardedMutex(&PnpNotifyListLock); - - DPRINT("IoRegisterPlugPlayNotification() returns NotificationEntry %p\n", - Entry); - *NotificationEntry = Entry; - return STATUS_SUCCESS; -} - -/* - * @implemented - */ -NTSTATUS -STDCALL -IoUnregisterPlugPlayNotification( - IN PVOID NotificationEntry) -{ - PPNP_NOTIFY_ENTRY Entry; - - PAGED_CODE(); - - Entry = (PPNP_NOTIFY_ENTRY)NotificationEntry; - DPRINT("IoUnregisterPlugPlayNotification(NotificationEntry %p) called\n", - Entry); - - KeAcquireGuardedMutex(&PnpNotifyListLock); - RtlFreeUnicodeString(&Entry->Guid); - RemoveEntryList(&Entry->PnpNotifyList); - KeReleaseGuardedMutex(&PnpNotifyListLock); - - return STATUS_SUCCESS; -} VOID IopNotifyPlugPlayNotification( @@ -323,4 +160,166 @@ ExFreePoolWithTag(NotificationStructure, TAG_PNP_NOTIFY); } -/* EOF */ +/* PUBLIC FUNCTIONS **********************************************************/ + +/* + * @unimplemented + */ +ULONG +NTAPI +IoPnPDeliverServicePowerNotification(ULONG VetoedPowerOperation OPTIONAL, + ULONG PowerNotification, + ULONG Unknown OPTIONAL, + BOOLEAN Synchronous) +{ + UNIMPLEMENTED; + return 0; +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +IoRegisterPlugPlayNotification(IN IO_NOTIFICATION_EVENT_CATEGORY EventCategory, + IN ULONG EventCategoryFlags, + IN PVOID EventCategoryData OPTIONAL, + IN PDRIVER_OBJECT DriverObject, + IN PDRIVER_NOTIFICATION_CALLBACK_ROUTINE CallbackRoutine, + IN PVOID Context, + OUT PVOID *NotificationEntry) +{ + PPNP_NOTIFY_ENTRY Entry; + PWSTR SymbolicLinkList; + NTSTATUS Status; + PAGED_CODE(); + + DPRINT("__FUNCTION__(EventCategory 0x%x, EventCategoryFlags 0x%lx, DriverObject %p) called.\n", + EventCategory, + EventCategoryFlags, + DriverObject); + + ObReferenceObject(DriverObject); + + /* Try to allocate entry for notification before sending any notification */ + Entry = ExAllocatePoolWithTag(NonPagedPool, + sizeof(PNP_NOTIFY_ENTRY), + TAG_PNP_NOTIFY); + + if (!Entry) + { + DPRINT("ExAllocatePool() failed\n"); + ObDereferenceObject(DriverObject); + return STATUS_INSUFFICIENT_RESOURCES; + } + + if (EventCategory == EventCategoryDeviceInterfaceChange && + EventCategoryFlags & PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES) + { + DEVICE_INTERFACE_CHANGE_NOTIFICATION NotificationInfos; + UNICODE_STRING SymbolicLinkU; + PWSTR SymbolicLink; + + Status = IoGetDeviceInterfaces((LPGUID)EventCategoryData, + NULL, /* PhysicalDeviceObject OPTIONAL */ + 0, /* Flags */ + &SymbolicLinkList); + if (!NT_SUCCESS(Status)) + { + DPRINT("IoGetDeviceInterfaces() failed with status 0x%08lx\n", + Status); + ExFreePoolWithTag(Entry, TAG_PNP_NOTIFY); + ObDereferenceObject(DriverObject); + return Status; + } + + /* Enumerate SymbolicLinkList */ + NotificationInfos.Version = 1; + NotificationInfos.Size = sizeof(DEVICE_INTERFACE_CHANGE_NOTIFICATION); + RtlCopyMemory(&NotificationInfos.Event, + &GUID_DEVICE_INTERFACE_ARRIVAL, + sizeof(GUID)); + RtlCopyMemory(&NotificationInfos.InterfaceClassGuid, + EventCategoryData, + sizeof(GUID)); + NotificationInfos.SymbolicLinkName = &SymbolicLinkU; + + for (SymbolicLink = SymbolicLinkList; + *SymbolicLink; + SymbolicLink += wcslen(SymbolicLink) + 1) + { + RtlInitUnicodeString(&SymbolicLinkU, SymbolicLink); + DPRINT("Calling callback routine for %S\n", SymbolicLink); + (*CallbackRoutine)(&NotificationInfos, Context); + } + + ExFreePool(SymbolicLinkList); + } + + Entry->PnpNotificationProc = CallbackRoutine; + Entry->EventCategory = EventCategory; + Entry->Context = Context; + switch (EventCategory) + { + case EventCategoryDeviceInterfaceChange: + { + Status = RtlStringFromGUID(EventCategoryData, &Entry->Guid); + if (!NT_SUCCESS(Status)) + { + ExFreePoolWithTag(Entry, TAG_PNP_NOTIFY); + ObDereferenceObject(DriverObject); + return Status; + } + break; + } + case EventCategoryHardwareProfileChange: + { + /* nothing to do */ + break; + } + case EventCategoryTargetDeviceChange: + { + Entry->FileObject = (PFILE_OBJECT)EventCategoryData; + break; + } + default: + { + DPRINT1("__FUNCTION__(): unknown EventCategory 0x%x UNIMPLEMENTED\n", + EventCategory); + break; + } + } + + KeAcquireGuardedMutex(&PnpNotifyListLock); + InsertHeadList(&PnpNotifyListHead, + &Entry->PnpNotifyList); + KeReleaseGuardedMutex(&PnpNotifyListLock); + + DPRINT("IoRegisterPlugPlayNotification() returns NotificationEntry %p\n", + Entry); + + *NotificationEntry = Entry; + + return STATUS_SUCCESS; +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +IoUnregisterPlugPlayNotification(IN PVOID NotificationEntry) +{ + PPNP_NOTIFY_ENTRY Entry; + PAGED_CODE(); + + Entry = (PPNP_NOTIFY_ENTRY)NotificationEntry; + DPRINT("__FUNCTION__(NotificationEntry %p) called\n", Entry); + + KeAcquireGuardedMutex(&PnpNotifyListLock); + RtlFreeUnicodeString(&Entry->Guid); + RemoveEntryList(&Entry->PnpNotifyList); + KeReleaseGuardedMutex(&PnpNotifyListLock); + + return STATUS_SUCCESS; +} Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnprepo…
============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c [iso-8859-1] Mon Aug 18 08:30:17 2008 @@ -1,9 +1,8 @@ /* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/pnpreport.c - * PURPOSE: Device Changes Reporting functions - * + * PROJECT: ReactOS Kernel + * COPYRIGHT: GPL - See COPYING in the top level directory + * FILE: ntoskrnl/io/pnpmgr/pnpreport.c + * PURPOSE: Device Changes Reporting Functions * PROGRAMMERS: Filip Navara (xnavara(a)volny.cz) */ @@ -13,116 +12,127 @@ #define NDEBUG #include <debug.h> -/* FUNCTIONS *****************************************************************/ +/* PUBLIC FUNCTIONS **********************************************************/ /* * @implemented */ NTSTATUS -STDCALL -IoReportDetectedDevice( - IN PDRIVER_OBJECT DriverObject, - IN INTERFACE_TYPE LegacyBusType, - IN ULONG BusNumber, - IN ULONG SlotNumber, - IN PCM_RESOURCE_LIST ResourceList, - IN PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements OPTIONAL, - IN BOOLEAN ResourceAssigned, - IN OUT PDEVICE_OBJECT *DeviceObject) +NTAPI +IoReportDetectedDevice(IN PDRIVER_OBJECT DriverObject, + IN INTERFACE_TYPE LegacyBusType, + IN ULONG BusNumber, + IN ULONG SlotNumber, + IN PCM_RESOURCE_LIST ResourceList, + IN PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements OPTIONAL, + IN BOOLEAN ResourceAssigned, + IN OUT PDEVICE_OBJECT *DeviceObject OPTIONAL) { - PDEVICE_NODE DeviceNode; - PDEVICE_OBJECT Pdo; - NTSTATUS Status = STATUS_SUCCESS; + PDEVICE_NODE DeviceNode; + PDEVICE_OBJECT Pdo; + NTSTATUS Status = STATUS_SUCCESS; - DPRINT("IoReportDetectedDevice (DeviceObject %p, *DeviceObject %p)\n", - DeviceObject, DeviceObject ? *DeviceObject : NULL); + DPRINT("__FUNCTION__ (DeviceObject %p, *DeviceObject %p)\n", + DeviceObject, DeviceObject ? *DeviceObject : NULL); - /* if *DeviceObject is not NULL, we must use it as a PDO, - * and don't create a new one. - */ - if (DeviceObject && *DeviceObject) - Pdo = *DeviceObject; - else - { - UNICODE_STRING ServiceName; - ServiceName.Buffer = DriverObject->DriverName.Buffer + sizeof(DRIVER_ROOT_NAME) / sizeof(WCHAR) - 1; - ServiceName.Length = ServiceName.MaximumLength = DriverObject->DriverName.Length - sizeof(DRIVER_ROOT_NAME) + sizeof(WCHAR); + /* if *DeviceObject is not NULL, we must use it as a PDO, and don't create a new one */ + if (DeviceObject && *DeviceObject) + { + Pdo = *DeviceObject; + } + else + { + UNICODE_STRING ServiceName; + ServiceName.Buffer = DriverObject->DriverName.Buffer + + sizeof(DRIVER_ROOT_NAME) / sizeof(WCHAR) - 1; + ServiceName.Length = DriverObject->DriverName.Length - + sizeof(DRIVER_ROOT_NAME) + sizeof(WCHAR); + ServiceName.MaximumLength = ServiceName.Length; - /* create a new PDO and return it in *DeviceObject */ - Status = IopCreateDeviceNode(IopRootDeviceNode, NULL, &ServiceName, &DeviceNode); - if (!NT_SUCCESS(Status)) - { - DPRINT("IopCreateDeviceNode() failed (Status 0x%08lx)\n", Status); - return Status; - } - Pdo = DeviceNode->PhysicalDeviceObject; - if (DeviceObject) - *DeviceObject = Pdo; + /* create a new PDO and return it in *DeviceObject */ + Status = IopCreateDeviceNode(IopRootDeviceNode, + NULL, + &ServiceName, + &DeviceNode); + + if (!NT_SUCCESS(Status)) + { + DPRINT("IopCreateDeviceNode() failed (Status 0x%08lx)\n", Status); + return Status; + } + + Pdo = DeviceNode->PhysicalDeviceObject; + if (DeviceObject) *DeviceObject = Pdo; } - /* we don't need to call AddDevice and send IRP_MN_START_DEVICE */ - - return Status; + /* we don't need to call AddDevice and send IRP_MN_START_DEVICE */ + return Status; } /* * @unimplemented */ NTSTATUS -STDCALL -IoReportResourceForDetection( - IN PDRIVER_OBJECT DriverObject, - IN PCM_RESOURCE_LIST DriverList OPTIONAL, - IN ULONG DriverListSize OPTIONAL, - IN PDEVICE_OBJECT DeviceObject OPTIONAL, - IN PCM_RESOURCE_LIST DeviceList OPTIONAL, - IN ULONG DeviceListSize OPTIONAL, - OUT PBOOLEAN ConflictDetected) +NTAPI +IoReportResourceForDetection(IN PDRIVER_OBJECT DriverObject, + IN PCM_RESOURCE_LIST DriverList OPTIONAL, + IN ULONG DriverListSize OPTIONAL, + IN PDEVICE_OBJECT DeviceObject OPTIONAL, + IN PCM_RESOURCE_LIST DeviceList OPTIONAL, + IN ULONG DeviceListSize OPTIONAL, + OUT PBOOLEAN ConflictDetected) { - static int warned = 0; - if (!warned) - { - DPRINT1("IoReportResourceForDetection partly implemented\n"); - warned = 1; - } + static int warned = 0; + if (!warned) + { + DPRINT1("IoReportResourceForDetection partly implemented\n"); + warned = 1; + } - *ConflictDetected = FALSE; + *ConflictDetected = FALSE; - if (PopSystemPowerDeviceNode != NULL && DriverListSize > 0) - { - /* We hope legacy devices will be enumerated by ACPI */ - *ConflictDetected = TRUE; - return STATUS_CONFLICTING_ADDRESSES; - } - return STATUS_SUCCESS; + if (PopSystemPowerDeviceNode && DriverListSize > 0) + { + /* We hope legacy devices will be enumerated by ACPI */ + *ConflictDetected = TRUE; + return STATUS_CONFLICTING_ADDRESSES; + } + + return STATUS_SUCCESS; +} + +VOID +NTAPI +IopSetEvent(IN PVOID Context) +{ + PKEVENT Event = Context; + + /* Set the event */ + KeSetEvent(Event, IO_NO_INCREMENT, FALSE); } /* * @unimplemented */ NTSTATUS -STDCALL -IoReportTargetDeviceChange( - IN PDEVICE_OBJECT PhysicalDeviceObject, - IN PVOID NotificationStructure) +NTAPI +IoReportTargetDeviceChange(IN PDEVICE_OBJECT PhysicalDeviceObject, + IN PVOID NotificationStructure) { - DPRINT1("IoReportTargetDeviceChange called (UNIMPLEMENTED)\n"); - return STATUS_NOT_IMPLEMENTED; + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; } /* * @unimplemented */ NTSTATUS -STDCALL -IoReportTargetDeviceChangeAsynchronous( - IN PDEVICE_OBJECT PhysicalDeviceObject, - IN PVOID NotificationStructure, - IN PDEVICE_CHANGE_COMPLETE_CALLBACK Callback OPTIONAL, - IN PVOID Context OPTIONAL) +NTAPI +IoReportTargetDeviceChangeAsynchronous(IN PDEVICE_OBJECT PhysicalDeviceObject, + IN PVOID NotificationStructure, + IN PDEVICE_CHANGE_COMPLETE_CALLBACK Callback OPTIONAL, + IN PVOID Context OPTIONAL) { - DPRINT1("IoReportTargetDeviceChangeAsynchronous called (UNIMPLEMENTED)\n"); - return STATUS_NOT_IMPLEMENTED; + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; } - -/* EOF */ Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnproot…
============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c [iso-8859-1] Mon Aug 18 08:30:17 2008 @@ -1,9 +1,8 @@ /* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/pnproot.c + * PROJECT: ReactOS Kernel + * COPYRIGHT: GPL - See COPYING in the top level directory + * FILE: ntoskrnl/io/pnpmgr/pnproot.c * PURPOSE: PnP manager root device - * * PROGRAMMERS: Casper S. Hornstrup (chorns(a)users.sourceforge.net) * Copyright 2007 Hervé Poussineau (hpoussin(a)reactos.org) */ @@ -1135,5 +1134,3 @@ return STATUS_SUCCESS; } - -/* EOF */
16 years, 2 months
1
0
0
0
[arty] 35426: More WIP. Actually implement pinning and flushing, among other things. VFAT still isn't writing. Figuring out why.
by arty@svn.reactos.org
Author: arty Date: Mon Aug 18 06:01:17 2008 New Revision: 35426 URL:
http://svn.reactos.org/svn/reactos?rev=35426&view=rev
Log: More WIP. Actually implement pinning and flushing, among other things. VFAT still isn't writing. Figuring out why. Modified: branches/arty-newcc/ntoskrnl/cache/cachesub.c branches/arty-newcc/ntoskrnl/cache/copysup.c branches/arty-newcc/ntoskrnl/cache/fssup.c branches/arty-newcc/ntoskrnl/cache/pinsup.c branches/arty-newcc/ntoskrnl/include/internal/cc.h branches/arty-newcc/ntoskrnl/mm/section.c Modified: branches/arty-newcc/ntoskrnl/cache/cachesub.c URL:
http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/cache/cache…
============================================================================== --- branches/arty-newcc/ntoskrnl/cache/cachesub.c [iso-8859-1] (original) +++ branches/arty-newcc/ntoskrnl/cache/cachesub.c [iso-8859-1] Mon Aug 18 06:01:17 2008 @@ -37,7 +37,7 @@ NTSTATUS Status; PIRP Irp = NULL; KEVENT ReadWait; - PDEVICE_OBJECT DeviceObject = MmGetDeviceObjectForFile(FileObject); + PDEVICE_OBJECT DeviceObject; PIO_STACK_LOCATION IrpSp; KIRQL OldIrql; @@ -47,11 +47,11 @@ !MmIsCOWAddress(PsInitialSystemProcess, Buffer)) { DPRINT1 - ("PAGING WRITE (FLUSH) File %wZ Offset %x Length %d\n", - &FileObject->FileName, + ("PAGING WRITE (FLUSH) Offset %x Length %d\n", FileOffset->u.LowPart, Length); + DeviceObject = MmGetDeviceObjectForFile(FileObject); MmSetCleanPage(PsInitialSystemProcess, Buffer); KeLowerIrql(OldIrql); @@ -185,8 +185,6 @@ LARGE_INTEGER ToWrite = *FileOffset; IO_STATUS_BLOCK IOSB; - DPRINT("CcFlushCache\n"); - BOOLEAN Result = CcpMapData ((PNOCC_CACHE_MAP)SectionObjectPointer->SharedCacheMap, FileOffset, @@ -200,20 +198,22 @@ BufStart = (PCHAR)PAGE_ROUND_DOWN(((ULONG_PTR)Buffer)); ToWrite.LowPart = PAGE_ROUND_DOWN(FileOffset->LowPart); + DPRINT + ("CcpSimpleWrite: [%wZ] %x:%d\n", + &Bcb->FileObject->FileName, + Buffer, + Bcb->Length); + for (BufPage = BufStart; BufPage < BufStart + PAGE_ROUND_UP(Length); BufPage += PAGE_SIZE) { - DPRINT - ("CcpSimpleWrite: [%wZ] %x:%d\n", - &Bcb->FileObject->FileName, - Bcb->FileOffset.LowPart, - Bcb->Length); CcpSimpleWrite(Bcb->FileObject, &ToWrite, BufPage, &IOSB); - DPRINT - ("Page Write: %08x\n", IOSB.Status); ToWrite.QuadPart += PAGE_SIZE; } + + DPRINT + ("Page Write: %08x\n", IOSB.Status); CcUnpinData(Bcb); @@ -227,7 +227,6 @@ IoStatus->Status = IOSB.Status; IoStatus->Information = 0; } - DPRINT("CcFlushCache -> %08x\n", IOSB.Status); } // Always succeeds for us Modified: branches/arty-newcc/ntoskrnl/cache/copysup.c URL:
http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/cache/copys…
============================================================================== --- branches/arty-newcc/ntoskrnl/cache/copysup.c [iso-8859-1] (original) +++ branches/arty-newcc/ntoskrnl/cache/copysup.c [iso-8859-1] Mon Aug 18 06:01:17 2008 @@ -153,7 +153,7 @@ Count = i; - DPRINT("Copying %d bytes for Read\n", Length); + DPRINT("Copying %d bytes for Write\n", Length); for (WriteBuf = (PCHAR)Buffer, WriteLen = Length, i = 0; WriteLen > 0; Modified: branches/arty-newcc/ntoskrnl/cache/fssup.c URL:
http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/cache/fssup…
============================================================================== --- branches/arty-newcc/ntoskrnl/cache/fssup.c [iso-8859-1] (original) +++ branches/arty-newcc/ntoskrnl/cache/fssup.c [iso-8859-1] Mon Aug 18 06:01:17 2008 @@ -59,6 +59,7 @@ KEBUGCHECK(0); } +#if 0 Status = PsCreateSystemThread (&CcLazyWriteThreadHandle, THREAD_ALL_ACCESS, @@ -67,6 +68,7 @@ &CcLazyWriteThreadId, (PKSTART_ROUTINE) CcpLazyWriteThread, NULL); +#endif if (!NT_SUCCESS(Status)) { @@ -101,12 +103,12 @@ IN PCACHE_MANAGER_CALLBACKS Callbacks, IN PVOID LazyWriteContext) { - DPRINT("Initializing file object for %wZ\n", &FileObject->FileName); - PNOCC_CACHE_MAP Map = ExAllocatePool(NonPagedPool, sizeof(NOCC_CACHE_MAP)); + DPRINT("Initializing file object for %wZ\n", &FileObject->FileName); + PNOCC_CACHE_MAP Map = ExAllocatePool(NonPagedPool, sizeof(NOCC_CACHE_MAP)); FileObject->SectionObjectPointer->SharedCacheMap = Map; - Map->FileObject = FileObject; - Map->NumberOfMaps = 0; - InitializeListHead(&Map->AssociatedBcb); + Map->FileObject = FileObject; + Map->NumberOfMaps = 0; + InitializeListHead(&Map->AssociatedBcb); return; } @@ -116,30 +118,52 @@ IN OPTIONAL PLARGE_INTEGER TruncateSize, IN OPTIONAL PCACHE_UNINITIALIZE_EVENT UninitializeEvent) { - PNOCC_CACHE_MAP Map = (PNOCC_CACHE_MAP)FileObject->SectionObjectPointer->SharedCacheMap; - PNOCC_BCB Bcb; - PLIST_ENTRY Entry; - - DPRINT("Uninitializing file object for %wZ\n", &FileObject->FileName); - + PNOCC_CACHE_MAP Map = (PNOCC_CACHE_MAP)FileObject->SectionObjectPointer->SharedCacheMap; + PNOCC_BCB Bcb; + PLIST_ENTRY Entry; + IO_STATUS_BLOCK IOSB; + + DPRINT("Uninitializing file object for %wZ\n", &FileObject->FileName); + ASSERT(UninitializeEvent == NULL); - CcpLock(); - - for (Entry = ((PNOCC_CACHE_MAP)FileObject->SectionObjectPointer->SharedCacheMap)->AssociatedBcb.Flink; - Entry != &((PNOCC_CACHE_MAP)FileObject->SectionObjectPointer->SharedCacheMap)->AssociatedBcb; - Entry = Entry->Flink) - { - Bcb = CONTAINING_RECORD(Entry, NOCC_BCB, ThisFileList); - if (Bcb->RefCount == 1) - { - DPRINT("Unmapping #%x\n", Bcb - CcCacheSections); - CcpDereferenceCache(Bcb - CcCacheSections); - } - } - CcpUnlock(); - - ExFreePool(Map); - + + for (Entry = Map->AssociatedBcb.Flink; + Entry != &Map->AssociatedBcb; + Entry = Entry->Flink) + { + Bcb = CONTAINING_RECORD(Entry, NOCC_BCB, ThisFileList); + + if (!Bcb->Dirty) continue; + + if (Bcb->RefCount == 1) + { + DPRINT("Flushing #%x\n", Bcb - CcCacheSections); + CcFlushCache + (Bcb->FileObject->SectionObjectPointer, + &Bcb->FileOffset, + Bcb->Length, + &IOSB); + } + } + + CcpLock(); + + for (Entry = Map->AssociatedBcb.Flink; + Entry != &Map->AssociatedBcb; + Entry = Entry->Flink) + { + Bcb = CONTAINING_RECORD(Entry, NOCC_BCB, ThisFileList); + if (Bcb->RefCount == 1) + { + DPRINT("Unmapping #%x\n", Bcb - CcCacheSections); + CcpDereferenceCache(Bcb - CcCacheSections); + } + } + + CcpUnlock(); + + ExFreePool(Map); + /* Clear the cache map */ FileObject->SectionObjectPointer->SharedCacheMap = NULL; return TRUE; Modified: branches/arty-newcc/ntoskrnl/cache/pinsup.c URL:
http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/cache/pinsu…
============================================================================== --- branches/arty-newcc/ntoskrnl/cache/pinsup.c [iso-8859-1] (original) +++ branches/arty-newcc/ntoskrnl/cache/pinsup.c [iso-8859-1] Mon Aug 18 06:01:17 2008 @@ -43,64 +43,80 @@ (PFILE_OBJECT FileObject, PNOCC_BCB Bcb) { - PLIST_ENTRY Entry; - - for (Entry = ((PNOCC_CACHE_MAP)FileObject->SectionObjectPointer->SharedCacheMap)->AssociatedBcb.Flink; - Entry != &((PNOCC_CACHE_MAP)FileObject->SectionObjectPointer->SharedCacheMap)->AssociatedBcb; - Entry = Entry->Flink) - { - ASSERT(CONTAINING_RECORD(Entry, NOCC_BCB, ThisFileList) != Bcb); - } + PLIST_ENTRY Entry; + + for (Entry = ((PNOCC_CACHE_MAP)FileObject->SectionObjectPointer->SharedCacheMap)->AssociatedBcb.Flink; + Entry != &((PNOCC_CACHE_MAP)FileObject->SectionObjectPointer->SharedCacheMap)->AssociatedBcb; + Entry = Entry->Flink) + { + ASSERT(CONTAINING_RECORD(Entry, NOCC_BCB, ThisFileList) != Bcb); + } } VOID CcpLock() { + KeAcquireGuardedMutex(&CcMutex); + //DPRINT("<<<---<<< CC In Mutex!\n"); +} + +NTSTATUS +NTAPI +CcpSimpleWrite +(PFILE_OBJECT FileObject, + PLARGE_INTEGER FileOffset, + PVOID Buffer, + PIO_STATUS_BLOCK ReadStatus); + +VOID CcpPerformUnmapWork() +{ + NOCC_UNMAP_CHAIN WorkingOn; + IO_STATUS_BLOCK IoStatus; + ULONG NumElements; + PCHAR BufStart, BufPage; + LARGE_INTEGER ToWrite; + + KeAcquireGuardedMutex(&CcMutex); + while (CcOutstandingDeletes > 0) + { + NumElements = InterlockedDecrement(&CcOutstandingDeletes); + DPRINT1("Unmapping %d ...\n", NumElements); + WorkingOn = CcUnmapChain[0]; + RtlMoveMemory(&CcUnmapChain[0], &CcUnmapChain[1], NumElements * sizeof(NOCC_UNMAP_CHAIN)); + KeReleaseGuardedMutex(&CcMutex); + + BufStart = (PCHAR)WorkingOn.Buffer; + ToWrite = WorkingOn.FileOffset; + + for (BufPage = BufStart; + BufPage < BufStart + WorkingOn.Length; + BufPage += PAGE_SIZE) + { + CcpSimpleWrite(WorkingOn.FileObject, &ToWrite, BufPage, &IoStatus); + ToWrite.QuadPart += PAGE_SIZE; + } + + MmUnmapViewInSystemSpace(WorkingOn.Buffer); + ObDereferenceObject(WorkingOn.SectionObject); + DPRINT1("Done unmapping\n"); KeAcquireGuardedMutex(&CcMutex); - //DPRINT("<<<---<<< CC In Mutex!\n"); -} - -VOID CcpPerformUnmapWork() -{ - NOCC_UNMAP_CHAIN WorkingOn; - IO_STATUS_BLOCK IoStatus; - ULONG NumElements; - - KeAcquireGuardedMutex(&CcMutex); - while (CcOutstandingDeletes > 0) - { - NumElements = InterlockedDecrement(&CcOutstandingDeletes); - DPRINT1("Unmapping %d ...\n", NumElements); - WorkingOn = CcUnmapChain[0]; - RtlMoveMemory(&CcUnmapChain[0], &CcUnmapChain[1], NumElements * sizeof(NOCC_UNMAP_CHAIN)); - KeReleaseGuardedMutex(&CcMutex); - CcFlushCache - (WorkingOn.FileObject->SectionObjectPointer, - &WorkingOn.FileOffset, - WorkingOn.Length, - &IoStatus); - DPRINT1("Status result from flush: %08x\n", IoStatus.Status); - MmUnmapViewInSystemSpace(WorkingOn.Buffer); - ObDereferenceObject(WorkingOn.SectionObject); - DPRINT1("Done unmapping\n"); - KeAcquireGuardedMutex(&CcMutex); - } - KeReleaseGuardedMutex(&CcMutex); + } + KeReleaseGuardedMutex(&CcMutex); } VOID CcpUnlock() { - //DPRINT(">>>--->>> CC Exit Mutex!\n"); - KeReleaseGuardedMutex(&CcMutex); + //DPRINT(">>>--->>> CC Exit Mutex!\n"); + KeReleaseGuardedMutex(&CcMutex); } VOID STDCALL CcpUnmapThread(PVOID Unused) { - while (TRUE) - { - KeWaitForSingleObject(&CcDeleteEvent, UserRequest, KernelMode, FALSE, NULL); - CcpPerformUnmapWork(); - } + while (TRUE) + { + KeWaitForSingleObject(&CcDeleteEvent, UserRequest, KernelMode, FALSE, NULL); + CcpPerformUnmapWork(); + } } PDEVICE_OBJECT @@ -109,50 +125,50 @@ VOID CcpUnmapSegment(ULONG Segment) { - PNOCC_BCB Bcb = &CcCacheSections[Segment]; - PNOCC_UNMAP_CHAIN UnmapWork = &CcUnmapChain[CcOutstandingDeletes]; - - ASSERT(Bcb->RefCount > 0); - DPRINT("CcpUnmapSegment(#%x)\n", Segment); - - InterlockedIncrement(&CcOutstandingDeletes); - UnmapWork->Buffer = Bcb->BaseAddress; - UnmapWork->SectionObject = Bcb->SectionObject; - UnmapWork->FileObject = Bcb->FileObject; - UnmapWork->FileOffset = Bcb->FileOffset; - UnmapWork->Length = Bcb->Length; - Bcb->BaseAddress = NULL; - Bcb->Length = 0; - Bcb->FileOffset.QuadPart = 0; - - KeSetEvent(&CcDeleteEvent, IO_DISK_INCREMENT, FALSE); + PNOCC_BCB Bcb = &CcCacheSections[Segment]; + PNOCC_UNMAP_CHAIN UnmapWork = &CcUnmapChain[CcOutstandingDeletes]; + + ASSERT(Bcb->RefCount > 0); + DPRINT("CcpUnmapSegment(#%x)\n", Segment); + + InterlockedIncrement(&CcOutstandingDeletes); + UnmapWork->Buffer = Bcb->BaseAddress; + UnmapWork->SectionObject = Bcb->SectionObject; + UnmapWork->FileObject = Bcb->FileObject; + UnmapWork->FileOffset = Bcb->FileOffset; + UnmapWork->Length = Bcb->Length; + Bcb->BaseAddress = NULL; + Bcb->Length = 0; + Bcb->FileOffset.QuadPart = 0; + + KeSetEvent(&CcDeleteEvent, IO_DISK_INCREMENT, FALSE); } NTSTATUS CcpMapSegment(ULONG Start) { - PNOCC_BCB Bcb = &CcCacheSections[Start]; - ULONG ViewSize = CACHE_STRIPE; - NTSTATUS Status; - - ASSERT(RtlTestBit(CcCacheBitmap, Start)); - DPRINT("CcpMapSegment(#%x)\n", Start); - - Status = MmMapViewInSystemSpaceAtOffset - (Bcb->SectionObject, - &Bcb->BaseAddress, - &Bcb->FileOffset, - &ViewSize); - - if (!NT_SUCCESS(Status)) - { - DPRINT("Failed to map view in system space: %x\n", Status); - return Status; - } - - DPRINT("System view is at %x\n", Bcb->BaseAddress); - Bcb->Length = ViewSize; - - return TRUE; + PNOCC_BCB Bcb = &CcCacheSections[Start]; + ULONG ViewSize = CACHE_STRIPE; + NTSTATUS Status; + + ASSERT(RtlTestBit(CcCacheBitmap, Start)); + DPRINT("CcpMapSegment(#%x)\n", Start); + + Status = MmMapViewInSystemSpaceAtOffset + (Bcb->SectionObject, + &Bcb->BaseAddress, + &Bcb->FileOffset, + &ViewSize); + + if (!NT_SUCCESS(Status)) + { + DPRINT("Failed to map view in system space: %x\n", Status); + return Status; + } + + DPRINT("System view is at %x\n", Bcb->BaseAddress); + Bcb->Length = ViewSize; + + return TRUE; } NTSTATUS CcpAllocateSection @@ -161,52 +177,52 @@ ULONG Protect, PSECTION_OBJECT *Result) { - NTSTATUS Status; - LARGE_INTEGER MaxSize; - - MaxSize.QuadPart = Length; - - Status = MmCreateSection - ((PVOID*)Result, - STANDARD_RIGHTS_REQUIRED, - NULL, - &MaxSize, - Protect, - SEC_RESERVE, - NULL, - FileObject); - - return Status; + NTSTATUS Status; + LARGE_INTEGER MaxSize; + + MaxSize.QuadPart = Length; + + Status = MmCreateSection + ((PVOID*)Result, + STANDARD_RIGHTS_REQUIRED, + NULL, + &MaxSize, + Protect, + SEC_RESERVE, + NULL, + FileObject); + + return Status; } /* Must have acquired the mutex */ VOID CcpDereferenceCache(ULONG Start) { - PNOCC_BCB Bcb; - PNOCC_CACHE_MAP Map; - - DPRINT("CcpDereferenceCache(#%x)\n", Start); - - Bcb = &CcCacheSections[Start]; - DPRINT("Dereference #%x (count %d)\n", Start, Bcb->RefCount); - ASSERT(Bcb->FileObject); - ASSERT(Bcb->SectionObject); - ASSERT(Bcb->RefCount == 1); - - Map = (PNOCC_CACHE_MAP)Bcb->FileObject->SectionObjectPointer->SharedCacheMap; - Map->NumberOfMaps--; - - DPRINT("Fully unreferencing Bcb #%x\n", Start); - CcpUnmapSegment(Start); - - RemoveEntryList(&Bcb->ThisFileList); - - Bcb->FileObject = NULL; - Bcb->SectionObject = NULL; - Bcb->BaseAddress = NULL; - Bcb->FileOffset.QuadPart = 0; - Bcb->Length = 0; - Bcb->RefCount = 0; + PNOCC_BCB Bcb; + PNOCC_CACHE_MAP Map; + + DPRINT("CcpDereferenceCache(#%x)\n", Start); + + Bcb = &CcCacheSections[Start]; + DPRINT("Dereference #%x (count %d)\n", Start, Bcb->RefCount); + ASSERT(Bcb->FileObject); + ASSERT(Bcb->SectionObject); + ASSERT(Bcb->RefCount == 1); + + Map = (PNOCC_CACHE_MAP)Bcb->FileObject->SectionObjectPointer->SharedCacheMap; + Map->NumberOfMaps--; + + DPRINT("Fully unreferencing Bcb #%x\n", Start); + CcpUnmapSegment(Start); + + RemoveEntryList(&Bcb->ThisFileList); + + Bcb->FileObject = NULL; + Bcb->SectionObject = NULL; + Bcb->BaseAddress = NULL; + Bcb->FileOffset.QuadPart = 0; + Bcb->Length = 0; + Bcb->RefCount = 0; } /* Needs mutex */ @@ -215,67 +231,67 @@ PSECTION_OBJECT SectionObject, PLARGE_INTEGER FileOffset) { - ULONG i = INVALID_CACHE; - PNOCC_CACHE_MAP Map; - PNOCC_BCB Bcb; - - DPRINT("AllocateCacheSections: FileObject %x\n", FileObject); - - if (!FileObject->SectionObjectPointer) - return INVALID_CACHE; - - Map = (PNOCC_CACHE_MAP)FileObject->SectionObjectPointer->SharedCacheMap; - - if (!Map) - return INVALID_CACHE; - - DPRINT("Allocating Cache Section (File already has %d sections)\n", Map->NumberOfMaps); - - i = RtlFindClearBitsAndSet - (CcCacheBitmap, 1, CcCacheClockHand); - CcCacheClockHand = i + 1; - - if (i != INVALID_CACHE) - { - DPRINT("Setting up Bcb #%x\n", i); - - Bcb = &CcCacheSections[i]; - - ASSERT(Bcb->RefCount < 2); - - if (Bcb->RefCount > 0) - { - CcpDereferenceCache(i); - } - - ASSERT(!Bcb->RefCount); - - Bcb->RefCount = 1; - DPRINT("Bcb #%x RefCount %d\n", Bcb - CcCacheSections, Bcb->RefCount); - ObReferenceObject(SectionObject); - - Bcb->FileObject = FileObject; - Bcb->SectionObject = SectionObject; - Bcb->FileOffset = *FileOffset; - Bcb->Length = CACHE_STRIPE; - Map->NumberOfMaps++; - - InsertTailList(&Map->AssociatedBcb, &Bcb->ThisFileList); - - if (!RtlTestBit(CcCacheBitmap, i)) - { - DPRINT("Somebody stoeled BCB #%x\n", i); - } - ASSERT(RtlTestBit(CcCacheBitmap, i)); - - DPRINT("Allocated #%x\n", i); - ASSERT(CcCacheSections[i].RefCount); - } - else - { - DPRINT("Failed to allocate cache segment\n"); - } - return i; + ULONG i = INVALID_CACHE; + PNOCC_CACHE_MAP Map; + PNOCC_BCB Bcb; + + DPRINT("AllocateCacheSections: FileObject %x\n", FileObject); + + if (!FileObject->SectionObjectPointer) + return INVALID_CACHE; + + Map = (PNOCC_CACHE_MAP)FileObject->SectionObjectPointer->SharedCacheMap; + + if (!Map) + return INVALID_CACHE; + + DPRINT("Allocating Cache Section (File already has %d sections)\n", Map->NumberOfMaps); + + i = RtlFindClearBitsAndSet + (CcCacheBitmap, 1, CcCacheClockHand); + CcCacheClockHand = i + 1; + + if (i != INVALID_CACHE) + { + DPRINT("Setting up Bcb #%x\n", i); + + Bcb = &CcCacheSections[i]; + + ASSERT(Bcb->RefCount < 2); + + if (Bcb->RefCount > 0) + { + CcpDereferenceCache(i); + } + + ASSERT(!Bcb->RefCount); + + Bcb->RefCount = 1; + DPRINT("Bcb #%x RefCount %d\n", Bcb - CcCacheSections, Bcb->RefCount); + ObReferenceObject(SectionObject); + + Bcb->FileObject = FileObject; + Bcb->SectionObject = SectionObject; + Bcb->FileOffset = *FileOffset; + Bcb->Length = CACHE_STRIPE; + Map->NumberOfMaps++; + + InsertTailList(&Map->AssociatedBcb, &Bcb->ThisFileList); + + if (!RtlTestBit(CcCacheBitmap, i)) + { + DPRINT("Somebody stoeled BCB #%x\n", i); + } + ASSERT(RtlTestBit(CcCacheBitmap, i)); + + DPRINT("Allocated #%x\n", i); + ASSERT(CcCacheSections[i].RefCount); + } + else + { + DPRINT("Failed to allocate cache segment\n"); + } + return i; } /* @@ -283,86 +299,86 @@ */ ULONG CcpFindCacheFor(PNOCC_CACHE_MAP Map) { - if (!Map) - return INVALID_CACHE; - else - { - if (IsListEmpty(&Map->AssociatedBcb)) - return INVALID_CACHE; - PNOCC_BCB Bcb = CONTAINING_RECORD - (Map->AssociatedBcb.Flink, - NOCC_BCB, - ThisFileList); - return Bcb - CcCacheSections; - } + if (!Map) + return INVALID_CACHE; + else + { + if (IsListEmpty(&Map->AssociatedBcb)) + return INVALID_CACHE; + PNOCC_BCB Bcb = CONTAINING_RECORD + (Map->AssociatedBcb.Flink, + NOCC_BCB, + ThisFileList); + return Bcb - CcCacheSections; + } } /* Must have acquired the mutex */ VOID CcpReferenceCache(ULONG Start) { - PNOCC_BCB Bcb; - Bcb = &CcCacheSections[Start]; - ASSERT(Bcb->FileObject); - ASSERT(Bcb->SectionObject); - Bcb->RefCount++; - RtlSetBit(CcCacheBitmap, Start); + PNOCC_BCB Bcb; + Bcb = &CcCacheSections[Start]; + ASSERT(Bcb->FileObject); + ASSERT(Bcb->SectionObject); + Bcb->RefCount++; + RtlSetBit(CcCacheBitmap, Start); } VOID CcpMarkForExclusive(ULONG Start) { - PNOCC_BCB Bcb; - Bcb = &CcCacheSections[Start]; - Bcb->ExclusiveWaiter++; + PNOCC_BCB Bcb; + Bcb = &CcCacheSections[Start]; + Bcb->ExclusiveWaiter++; } /* Must not have the mutex */ VOID CcpReferenceCacheExclusive(ULONG Start) { - PNOCC_BCB Bcb = &CcCacheSections[Start]; - - KeWaitForSingleObject(&Bcb->ExclusiveWait, Executive, KernelMode, FALSE, NULL); - CcpLock(); - ASSERT(Bcb->ExclusiveWaiter); - ASSERT(Bcb->FileObject); - ASSERT(Bcb->SectionObject); - Bcb->RefCount++; - Bcb->Exclusive = TRUE; - Bcb->ExclusiveWaiter--; - RtlSetBit(CcCacheBitmap, Start); - CcpUnlock(); + PNOCC_BCB Bcb = &CcCacheSections[Start]; + + KeWaitForSingleObject(&Bcb->ExclusiveWait, Executive, KernelMode, FALSE, NULL); + CcpLock(); + ASSERT(Bcb->ExclusiveWaiter); + ASSERT(Bcb->FileObject); + ASSERT(Bcb->SectionObject); + Bcb->RefCount++; + Bcb->Exclusive = TRUE; + Bcb->ExclusiveWaiter--; + RtlSetBit(CcCacheBitmap, Start); + CcpUnlock(); } /* Find a map that encompasses the target range */ /* Must have the mutex */ ULONG CcpFindMatchingMap(PNOCC_BCB Head, PLARGE_INTEGER FileOffset, ULONG Length) { - PLIST_ENTRY Entry; - - //DPRINT("Find Matching Map: %x:%x\n", FileOffset->LowPart, Length); - - if (FileOffset->QuadPart >= Head->FileOffset.QuadPart && - FileOffset->QuadPart + Length <= Head->FileOffset.QuadPart + Head->Length) - { - //DPRINT("Head matched\n"); - return Head - CcCacheSections; - } - - for (Entry = Head->ThisFileList.Flink; Entry != &Head->ThisFileList; Entry = Entry->Flink) - { - PNOCC_BCB Bcb = CONTAINING_RECORD(Entry, NOCC_BCB, ThisFileList); - //DPRINT("This File: %x:%x\n", Bcb->FileOffset.LowPart, Bcb->Length); - if (FileOffset->QuadPart >= Bcb->FileOffset.QuadPart && - FileOffset->QuadPart + Length <= Bcb->FileOffset.QuadPart + Bcb->Length) - { - //DPRINT("Found match at #%x\n", Bcb - CcCacheSections); - return Bcb - CcCacheSections; - } - } - - //DPRINT("This region isn't mapped\n"); - - return INVALID_CACHE; + PLIST_ENTRY Entry; + + //DPRINT("Find Matching Map: %x:%x\n", FileOffset->LowPart, Length); + + if (FileOffset->QuadPart >= Head->FileOffset.QuadPart && + FileOffset->QuadPart + Length <= Head->FileOffset.QuadPart + Head->Length) + { + //DPRINT("Head matched\n"); + return Head - CcCacheSections; + } + + for (Entry = Head->ThisFileList.Flink; Entry != &Head->ThisFileList; Entry = Entry->Flink) + { + PNOCC_BCB Bcb = CONTAINING_RECORD(Entry, NOCC_BCB, ThisFileList); + //DPRINT("This File: %x:%x\n", Bcb->FileOffset.LowPart, Bcb->Length); + if (FileOffset->QuadPart >= Bcb->FileOffset.QuadPart && + FileOffset->QuadPart + Length <= Bcb->FileOffset.QuadPart + Bcb->Length) + { + //DPRINT("Found match at #%x\n", Bcb - CcCacheSections); + return Bcb - CcCacheSections; + } + } + + //DPRINT("This region isn't mapped\n"); + + return INVALID_CACHE; } BOOLEAN @@ -375,130 +391,130 @@ OUT PVOID *BcbResult, OUT PVOID *Buffer) { - BOOLEAN Success = FALSE; - PFILE_OBJECT FileObject = Map->FileObject; - /* Note: windows 2000 drivers treat this as a bool */ - BOOLEAN Wait = (Flags & MAP_WAIT) || (Flags == TRUE); - LARGE_INTEGER Target; - ULONG BcbHead; - PNOCC_BCB Bcb = NULL; - PSECTION_OBJECT SectionObject = NULL; - NTSTATUS Status; - - DPRINT("CcMapData(F->%x,%x:%d)\n", Map, FileOffset->LowPart, Length); - - ASSERT(KeGetCurrentIrql() < DISPATCH_LEVEL); - - Target.QuadPart = CACHE_ROUND_DOWN(FileOffset->QuadPart); - - CcpLock(); - - /* Find out if any range is a superset of what we want */ - BcbHead = CcpFindCacheFor(Map); - - /* No bcbs for this file */ - if (BcbHead != INVALID_CACHE) - { - /* Find an accomodating section */ - //DPRINT("Selected BCB #%x\n", BcbHead); - Bcb = &CcCacheSections[BcbHead]; - SectionObject = Bcb->SectionObject; - BcbHead = CcpFindMatchingMap(Bcb, FileOffset, Length); - - if (BcbHead == INVALID_CACHE) - { - if (!Wait) - { - CcpUnlock(); - //DPRINT("End\n"); - goto cleanup; - } - } - else - { - Bcb = &CcCacheSections[BcbHead]; - Success = TRUE; - *BcbResult = Bcb; - *Buffer = ((PCHAR)Bcb->BaseAddress) + (int)(FileOffset->QuadPart - Bcb->FileOffset.QuadPart); - DPRINT - ("Bcb #%x Buffer maps (%x) At %x Length %x (Getting %x:%x)\n", - Bcb - CcCacheSections, - Bcb->FileOffset.LowPart, - Bcb->BaseAddress, - Bcb->Length, - *Buffer, - Length); - CcpUnlock(); - //DPRINT("w1n\n"); - goto cleanup; - } - } - - CcpUnlock(); - - if (!SectionObject) - { - Status = CcpAllocateSection - (FileObject, - CACHE_STRIPE, - PAGE_READWRITE, - &SectionObject); - - if (!NT_SUCCESS(Status)) - { - //DPRINT("End %08x\n", Status); - goto cleanup; - } - } - - /* Returns a reference */ - do - { - CcpLock(); - - BcbHead = CcpAllocateCacheSections - (FileObject, - SectionObject, - &Target); - + BOOLEAN Success = FALSE; + PFILE_OBJECT FileObject = Map->FileObject; + /* Note: windows 2000 drivers treat this as a bool */ + BOOLEAN Wait = (Flags & MAP_WAIT) || (Flags == TRUE); + LARGE_INTEGER Target; + ULONG BcbHead; + PNOCC_BCB Bcb = NULL; + PSECTION_OBJECT SectionObject = NULL; + NTSTATUS Status; + + DPRINT("CcMapData(F->%x,%x:%d)\n", Map, FileOffset->LowPart, Length); + + ASSERT(KeGetCurrentIrql() < DISPATCH_LEVEL); + + Target.QuadPart = CACHE_ROUND_DOWN(FileOffset->QuadPart); + + CcpLock(); + + /* Find out if any range is a superset of what we want */ + BcbHead = CcpFindCacheFor(Map); + + /* No bcbs for this file */ + if (BcbHead != INVALID_CACHE) + { + /* Find an accomodating section */ + //DPRINT("Selected BCB #%x\n", BcbHead); + Bcb = &CcCacheSections[BcbHead]; + SectionObject = Bcb->SectionObject; + BcbHead = CcpFindMatchingMap(Bcb, FileOffset, Length); + + if (BcbHead == INVALID_CACHE) + { + if (!Wait) + { CcpUnlock(); - } - while (BcbHead == INVALID_CACHE && - NT_SUCCESS - (KeWaitForSingleObject - (&CcDeleteEvent, UserRequest, KernelMode, FALSE, NULL))); - - if (BcbHead == INVALID_CACHE) - { //DPRINT("End\n"); goto cleanup; - } - - //DPRINT("Selected BCB #%x\n", BcbHead); - Bcb = &CcCacheSections[BcbHead]; - Status = CcpMapSegment(BcbHead); - - if (NT_SUCCESS(Status)) - { - Success = TRUE; - //DPRINT("w1n\n"); - *BcbResult = &CcCacheSections[BcbHead]; - *Buffer = ((PCHAR)Bcb->BaseAddress) + (int)(FileOffset->QuadPart - Bcb->FileOffset.QuadPart); - DPRINT - ("Bcb #%x Buffer maps (%x) At %x Length %x (Getting %x:%x)\n", - Bcb - CcCacheSections, - Bcb->FileOffset.LowPart, - Bcb->BaseAddress, - Bcb->Length, - *Buffer, - Length); - goto cleanup; - } - - //DPRINT("TERM!\n"); + } + } + else + { + Bcb = &CcCacheSections[BcbHead]; + Success = TRUE; + *BcbResult = Bcb; + *Buffer = ((PCHAR)Bcb->BaseAddress) + (int)(FileOffset->QuadPart - Bcb->FileOffset.QuadPart); + DPRINT + ("Bcb #%x Buffer maps (%x) At %x Length %x (Getting %x:%x)\n", + Bcb - CcCacheSections, + Bcb->FileOffset.LowPart, + Bcb->BaseAddress, + Bcb->Length, + *Buffer, + Length); + CcpUnlock(); + //DPRINT("w1n\n"); + goto cleanup; + } + } + + CcpUnlock(); + + if (!SectionObject) + { + Status = CcpAllocateSection + (FileObject, + CACHE_STRIPE, + PAGE_READWRITE, + &SectionObject); + + if (!NT_SUCCESS(Status)) + { + //DPRINT("End %08x\n", Status); + goto cleanup; + } + } + + /* Returns a reference */ + do + { + CcpLock(); + + BcbHead = CcpAllocateCacheSections + (FileObject, + SectionObject, + &Target); + + CcpUnlock(); + } + while (BcbHead == INVALID_CACHE && + NT_SUCCESS + (KeWaitForSingleObject + (&CcDeleteEvent, UserRequest, KernelMode, FALSE, NULL))); + + if (BcbHead == INVALID_CACHE) + { + //DPRINT("End\n"); + goto cleanup; + } + + //DPRINT("Selected BCB #%x\n", BcbHead); + Bcb = &CcCacheSections[BcbHead]; + Status = CcpMapSegment(BcbHead); + + if (NT_SUCCESS(Status)) + { + Success = TRUE; + //DPRINT("w1n\n"); + *BcbResult = &CcCacheSections[BcbHead]; + *Buffer = ((PCHAR)Bcb->BaseAddress) + (int)(FileOffset->QuadPart - Bcb->FileOffset.QuadPart); + DPRINT + ("Bcb #%x Buffer maps (%x) At %x Length %x (Getting %x:%x)\n", + Bcb - CcCacheSections, + Bcb->FileOffset.LowPart, + Bcb->BaseAddress, + Bcb->Length, + *Buffer, + Length); + goto cleanup; + } + + //DPRINT("TERM!\n"); cleanup: - return Success; + return Success; } BOOLEAN @@ -511,21 +527,21 @@ OUT PVOID *BcbResult, OUT PVOID *Buffer) { - if (!(PNOCC_CACHE_MAP)FileObject->SectionObjectPointer->SharedCacheMap) - { - PNOCC_CACHE_MAP Map = ExAllocatePool(NonPagedPool, sizeof(NOCC_CACHE_MAP)); - FileObject->SectionObjectPointer->SharedCacheMap = Map; - Map->FileObject = FileObject; - InitializeListHead(&Map->AssociatedBcb); - } - - return CcpMapData - ((PNOCC_CACHE_MAP)FileObject->SectionObjectPointer->SharedCacheMap, - FileOffset, - Length, - Flags, - BcbResult, - Buffer); + if (!(PNOCC_CACHE_MAP)FileObject->SectionObjectPointer->SharedCacheMap) + { + PNOCC_CACHE_MAP Map = ExAllocatePool(NonPagedPool, sizeof(NOCC_CACHE_MAP)); + FileObject->SectionObjectPointer->SharedCacheMap = Map; + Map->FileObject = FileObject; + InitializeListHead(&Map->AssociatedBcb); + } + + return CcpMapData + ((PNOCC_CACHE_MAP)FileObject->SectionObjectPointer->SharedCacheMap, + FileOffset, + Length, + Flags, + BcbResult, + Buffer); } BOOLEAN @@ -536,31 +552,45 @@ IN ULONG Flags, IN OUT PVOID *Bcb) { - BOOLEAN Wait = Flags & PIN_WAIT; - BOOLEAN Exclusive = Flags & PIN_EXCLUSIVE; - BOOLEAN Result; - ULONG BcbHead; - PVOID Buffer; - - Result = CcMapData(FileObject, FileOffset, Length, Wait ? MAP_WAIT : 0, Bcb, &Buffer); - BcbHead = ((PNOCC_BCB)*Bcb) - CcCacheSections; - - if (!Result) return FALSE; - - CcpLock(); - if (Exclusive) - { - DPRINT("Requesting #%x Exclusive\n", BcbHead); - CcpMarkForExclusive(BcbHead); - } - else - CcpReferenceCache(BcbHead); - CcpUnlock(); - - if (Exclusive) - CcpReferenceCacheExclusive(BcbHead); - - return TRUE; + BOOLEAN Wait = Flags & PIN_WAIT; + BOOLEAN Exclusive = Flags & PIN_EXCLUSIVE; + BOOLEAN Result; + ULONG BcbHead; + PNOCC_BCB TheBcb; + PVOID Buffer; + + Result = CcMapData(FileObject, FileOffset, Length, Wait ? MAP_WAIT : 0, Bcb, &Buffer); + + if (!Result) return FALSE; + + TheBcb = (PNOCC_BCB)Bcb; + BcbHead = TheBcb - CcCacheSections; + + CcpLock(); + if (Exclusive) + { + DPRINT("Requesting #%x Exclusive\n", BcbHead); + CcpMarkForExclusive(BcbHead); + } + else + CcpReferenceCache(BcbHead); + CcpUnlock(); + + if (Exclusive) + CcpReferenceCacheExclusive(BcbHead); + + if (!TheBcb->Pinned) + { + TheBcb->Pinned = IoAllocateMdl + (TheBcb->BaseAddress, + TheBcb->Length, + FALSE, + FALSE, + NULL); + MmProbeAndLockPages(TheBcb->Pinned, KernelMode, IoReadAccess); + } + + return TRUE; } BOOLEAN @@ -572,7 +602,24 @@ OUT PVOID *Bcb, OUT PVOID *Buffer) { - return CcMapData(FileObject, FileOffset, Length, Flags, Bcb, Buffer); + BOOLEAN Result = CcMapData(FileObject, FileOffset, Length, Flags, Bcb, Buffer); + + if (Result) + { + PNOCC_BCB TheBcb = (PNOCC_BCB)*Bcb; + if (!TheBcb->Pinned) + { + TheBcb->Pinned = IoAllocateMdl + (TheBcb->BaseAddress, + TheBcb->Length, + FALSE, + FALSE, + NULL); + MmProbeAndLockPages(TheBcb->Pinned, KernelMode, IoReadAccess); + } + } + + return Result; } BOOLEAN @@ -585,56 +632,73 @@ OUT PVOID *Bcb, OUT PVOID *Buffer) { - BOOLEAN GotIt = CcPinMappedData - (FileObject, - FileOffset, - Length, - Flags, - Bcb); - - PNOCC_BCB TheBcb = (PNOCC_BCB)*Bcb; - ULONG Start = TheBcb - CcCacheSections; - - DPRINT("CcPreparePinWrite(#%x)\n", Start); - - if (GotIt) - { - CcCacheSections[Start].Dirty = TRUE; - *Buffer = (PVOID)((PCHAR)TheBcb->BaseAddress + (FileOffset->QuadPart - TheBcb->FileOffset.QuadPart)); - DPRINT("Returning Buffer: %x\n", *Buffer); - } - - DPRINT("Done\n"); - return GotIt; + BOOLEAN GotIt = CcPinMappedData + (FileObject, + FileOffset, + Length, + Flags, + Bcb); + + PNOCC_BCB TheBcb = (PNOCC_BCB)*Bcb; + ULONG Start = TheBcb - CcCacheSections; + + DPRINT("CcPreparePinWrite(#%x)\n", Start); + + if (GotIt) + { + CcCacheSections[Start].Dirty = TRUE; + *Buffer = (PVOID)((PCHAR)TheBcb->BaseAddress + (FileOffset->QuadPart - TheBcb->FileOffset.QuadPart)); + DPRINT("Returning Buffer: %x\n", *Buffer); + if (!TheBcb->Pinned) + { + TheBcb->Pinned = IoAllocateMdl + (TheBcb->BaseAddress, + TheBcb->Length, + FALSE, + FALSE, + NULL); + MmProbeAndLockPages(TheBcb->Pinned, KernelMode, IoReadAccess); + } + } + + DPRINT("Done\n"); + return GotIt; } VOID NTAPI CcUnpinData(IN PVOID Bcb) { - PNOCC_BCB RealBcb = (PNOCC_BCB)Bcb; - ULONG Selected = RealBcb - CcCacheSections; - DPRINT("CcUnpinData Bcb #%x (RefCount %d)\n", Selected, RealBcb->RefCount); - CcpLock(); - if (RealBcb->RefCount <= 2) - { - DPRINT("Unset allocation bit #%x\n", Selected); - RtlClearBit(CcCacheBitmap, Selected); - RealBcb->Exclusive = FALSE; - if (RealBcb->ExclusiveWaiter) - { - DPRINT("Triggering exclusive waiter\n"); - KeSetEvent(&RealBcb->ExclusiveWait, IO_NO_INCREMENT, FALSE); - } - } - if (RealBcb->RefCount > 1) - { - DPRINT("Removing one reference #%x\n", Selected); - RealBcb->RefCount--; - ASSERT(RealBcb->RefCount); - } - CcpUnlock(); - KeSetEvent(&CcDeleteEvent, IO_DISK_INCREMENT, FALSE); + PNOCC_BCB RealBcb = (PNOCC_BCB)Bcb; + ULONG Selected = RealBcb - CcCacheSections; + DPRINT("CcUnpinData Bcb #%x (RefCount %d)\n", Selected, RealBcb->RefCount); + CcpLock(); + if (RealBcb->RefCount <= 2) + { + if (RealBcb->Pinned) + { + DPRINT("Unpin (actually) the memory\n"); + MmUnlockPages(RealBcb->Pinned); + IoFreeMdl(RealBcb->Pinned); + RealBcb->Pinned = NULL; + } + DPRINT("Unset allocation bit #%x\n", Selected); + RtlClearBit(CcCacheBitmap, Selected); + RealBcb->Exclusive = FALSE; + if (RealBcb->ExclusiveWaiter) + { + DPRINT("Triggering exclusive waiter\n"); + KeSetEvent(&RealBcb->ExclusiveWait, IO_NO_INCREMENT, FALSE); + } + } + if (RealBcb->RefCount > 1) + { + DPRINT("Removing one reference #%x\n", Selected); + RealBcb->RefCount--; + ASSERT(RealBcb->RefCount); + } + CcpUnlock(); + KeSetEvent(&CcDeleteEvent, IO_DISK_INCREMENT, FALSE); } VOID @@ -642,11 +706,11 @@ CcSetBcbOwnerPointer(IN PVOID Bcb, IN PVOID OwnerPointer) { - PNOCC_BCB RealBcb = (PNOCC_BCB)Bcb; - CcpLock(); - CcpReferenceCache(RealBcb - CcCacheSections); - RealBcb->OwnerPointer = OwnerPointer; - CcpUnlock(); + PNOCC_BCB RealBcb = (PNOCC_BCB)Bcb; + CcpLock(); + CcpReferenceCache(RealBcb - CcCacheSections); + RealBcb->OwnerPointer = OwnerPointer; + CcpUnlock(); } VOID @@ -654,7 +718,7 @@ CcUnpinDataForThread(IN PVOID Bcb, IN ERESOURCE_THREAD ResourceThreadId) { - CcUnpinData(Bcb); + CcUnpinData(Bcb); } /* EOF */ Modified: branches/arty-newcc/ntoskrnl/include/internal/cc.h URL:
http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/include/int…
============================================================================== --- branches/arty-newcc/ntoskrnl/include/internal/cc.h [iso-8859-1] (original) +++ branches/arty-newcc/ntoskrnl/include/internal/cc.h [iso-8859-1] Mon Aug 18 06:01:17 2008 @@ -130,21 +130,22 @@ /* So we know the initial request that was made */ PFILE_OBJECT FileObject; - PSECTION_OBJECT SectionObject; - LARGE_INTEGER FileOffset; - ULONG Length; - PVOID BaseAddress; - BOOLEAN Dirty; - PVOID OwnerPointer; - - /* Reference counts */ - ULONG RefCount; - - LIST_ENTRY ThisFileList; - - KEVENT ExclusiveWait; - BOOLEAN Exclusive; - ULONG ExclusiveWaiter; + PSECTION_OBJECT SectionObject; + LARGE_INTEGER FileOffset; + ULONG Length; + PVOID BaseAddress; + BOOLEAN Dirty; + PVOID OwnerPointer; + PMDL Pinned; + + /* Reference counts */ + ULONG RefCount; + + LIST_ENTRY ThisFileList; + + KEVENT ExclusiveWait; + ULONG ExclusiveWaiter; + BOOLEAN Exclusive; } NOCC_BCB, *PNOCC_BCB; typedef struct _NOCC_CACHE_MAP Modified: branches/arty-newcc/ntoskrnl/mm/section.c URL:
http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/mm/section.…
============================================================================== --- branches/arty-newcc/ntoskrnl/mm/section.c [iso-8859-1] (original) +++ branches/arty-newcc/ntoskrnl/mm/section.c [iso-8859-1] Mon Aug 18 06:01:17 2008 @@ -105,8 +105,8 @@ } else { - return IoGetRelatedDeviceObject(FileObject); - } + return IoGetRelatedDeviceObject(FileObject); + } } PFILE_OBJECT @@ -229,13 +229,22 @@ NTSTATUS Status; PIRP Irp = NULL; KEVENT ReadWait; - PDEVICE_OBJECT DeviceObject = MmGetDeviceObjectForFile(FileObject); + PDEVICE_OBJECT DeviceObject; PIO_STACK_LOCATION IrpSp; + ASSERT(FileObject); + ASSERT(FileOffset); + ASSERT(Buffer); + ASSERT(ReadStatus); + + DeviceObject = MmGetDeviceObjectForFile(FileObject); + + ASSERT(DeviceObject); + DPRINT1 - ("PAGING WRITE File %wZ Offset %x Length %d\n", - &FileObject->FileName, - FileOffset->u.LowPart, + ("PAGING WRITE: FileObject %x Offset %x Length %d\n", + &FileObject, + FileOffset->LowPart, Length); KeInitializeEvent(&ReadWait, NotificationEvent, FALSE); @@ -591,7 +600,6 @@ BOOLEAN PageOut) { ULONG Entry; - BOOLEAN IsDirectMapped = FALSE; Entry = MmGetPageEntrySectionSegment(Segment, Offset); if (Entry == 0) @@ -627,16 +635,6 @@ Page = PFN_FROM_SSE(Entry); FileObject = Section->FileObject; - if (FileObject != NULL && - !(Segment->Characteristics & IMAGE_SCN_MEM_SHARED)) - { - - if ((FileOffset.QuadPart % PAGE_SIZE) == 0 && - (Offset + PAGE_SIZE <= Segment->RawLength || !IsImageSection)) - { - IsDirectMapped = TRUE; - } - } SavedSwapEntry = MmGetSavedSwapEntryPage(Page); if (SavedSwapEntry == 0) @@ -657,10 +655,6 @@ else { MmSetPageEntrySectionSegment(Segment, Offset, 0); - if (!IsDirectMapped) - { - MmReleasePageMemoryConsumer(MC_USER, Page); - } } } else @@ -1542,7 +1536,6 @@ LARGE_INTEGER FileOffset; NTSTATUS Status; PFILE_OBJECT FileObject; - BOOLEAN DirectMapped; BOOLEAN IsImageSection; PEPROCESS Process = MmGetAddressSpaceOwner(AddressSpace); @@ -1561,22 +1554,6 @@ IsImageSection = Context.Section->AllocationAttributes & SEC_IMAGE ? TRUE : FALSE; FileObject = Context.Section->FileObject; - DirectMapped = FALSE; - if (FileObject != NULL && - !(Context.Segment->Characteristics & IMAGE_SCN_MEM_SHARED)) - { - /* - * If the file system is letting us go directly to the cache and the - * memory area was mapped at an offset in the file which is page aligned - * then note this is a direct mapped page. - */ - if ((FileOffset.QuadPart % PAGE_SIZE) == 0 && - (Context.Offset + PAGE_SIZE <= Context.Segment->RawLength || !IsImageSection)) - { - DirectMapped = TRUE; - } - } - /* * This should never happen since mappings of physical memory are never @@ -1616,14 +1593,6 @@ else { Context.Private = FALSE; - } - - /* - * Take an additional reference to the page or the cache segment. - */ - if (!(DirectMapped && !Context.Private)) - { - MmReferencePage(Page); } MmDeleteAllRmaps(Page, (PVOID)&Context, MmPageOutDeleteMapping); @@ -1687,31 +1656,6 @@ MmspCompleteAndReleasePageOp(PageOp); return(STATUS_SUCCESS); } - } - else if (!Context.Private && DirectMapped) - { - if (SwapEntry != 0) - { - DPRINT1("Found a swapentry for a non private and direct mapped page (address %x)\n", - Address); - KEBUGCHECK(0); - } - PageOp->Status = STATUS_SUCCESS; - MmspCompleteAndReleasePageOp(PageOp); - return(STATUS_SUCCESS); - } - else if (!Context.WasDirty && !DirectMapped && !Context.Private) - { - if (SwapEntry != 0) - { - DPRINT1("Found a swap entry for a non dirty, non private and not direct mapped page (address %x)\n", - Address); - KEBUGCHECK(0); - } - MmReleasePageMemoryConsumer(MC_USER, Page); - PageOp->Status = STATUS_SUCCESS; - MmspCompleteAndReleasePageOp(PageOp); - return(STATUS_SUCCESS); } else if (!Context.WasDirty && Context.Private && SwapEntry != 0) { @@ -1881,7 +1825,6 @@ BOOLEAN Private; NTSTATUS Status; PFILE_OBJECT FileObject; - BOOLEAN DirectMapped; BOOLEAN IsImageSection; PEPROCESS Process = MmGetAddressSpaceOwner(AddressSpace); @@ -1898,21 +1841,6 @@ IsImageSection = Section->AllocationAttributes & SEC_IMAGE ? TRUE : FALSE; FileObject = Section->FileObject; - DirectMapped = FALSE; - if (FileObject != NULL && - !(Segment->Characteristics & IMAGE_SCN_MEM_SHARED)) - { - /* - * If the file system is letting us go directly to the cache and the - * memory area was mapped at an offset in the file which is page aligned - * then note this is a direct mapped page. - */ - if (((Offset + Segment->FileOffset.QuadPart) % PAGE_SIZE) == 0 && - (Offset + PAGE_SIZE <= Segment->RawLength || !IsImageSection)) - { - DirectMapped = TRUE; - } - } /* * This should never happen since mappings of physical memory are never @@ -1957,39 +1885,6 @@ * Speculatively set all mappings of the page to clean. */ MmSetCleanAllRmaps(Page); - - /* - * If this page was direct mapped from the cache then the cache manager - * will take care of writing it back to disk. - */ - if (DirectMapped && !Private) - { - LONG RemainingLength; - NTSTATUS Status; - LARGE_INTEGER FileOffset; - IO_STATUS_BLOCK ReadStatus; - - FileOffset.QuadPart = Offset; - - RemainingLength = min(PAGE_SIZE, Segment->FileOffset.QuadPart + Segment->Length - FileOffset.QuadPart); - DPRINT("Writing no more than %d bytes\n", RemainingLength); - - if (RemainingLength > 0) - { - Status = MiSimpleWrite - (Section->FileObject, - &FileOffset, - Address, - RemainingLength, - &ReadStatus); - } else - Status = STATUS_SUCCESS; - - PageOp->Status = Status; - MmspCompleteAndReleasePageOp(PageOp); - - return(Status); - } /* * If necessary, allocate an entry in the paging file for this page
16 years, 2 months
1
0
0
0
[sginsberg] 35425: - STDCALL -> NTAPI
by sginsberg@svn.reactos.org
Author: sginsberg Date: Mon Aug 18 04:50:38 2008 New Revision: 35425 URL:
http://svn.reactos.org/svn/reactos?rev=35425&view=rev
Log: - STDCALL -> NTAPI Modified: trunk/reactos/ntoskrnl/ps/job.c Modified: trunk/reactos/ntoskrnl/ps/job.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/job.c?rev=3542…
============================================================================== --- trunk/reactos/ntoskrnl/ps/job.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ps/job.c [iso-8859-1] Mon Aug 18 04:50:38 2008 @@ -117,7 +117,7 @@ * @unimplemented */ NTSTATUS -STDCALL +NTAPI NtAssignProcessToJobObject ( HANDLE JobHandle, HANDLE ProcessHandle) @@ -216,7 +216,7 @@ * @unimplemented */ NTSTATUS -STDCALL +NTAPI NtCreateJobObject ( PHANDLE JobHandle, ACCESS_MASK DesiredAccess, @@ -321,7 +321,7 @@ * @implemented */ NTSTATUS -STDCALL +NTAPI NtIsProcessInJob ( IN HANDLE ProcessHandle, IN HANDLE JobHandle OPTIONAL ) @@ -389,7 +389,7 @@ * @implemented */ NTSTATUS -STDCALL +NTAPI NtOpenJobObject ( PHANDLE JobHandle, ACCESS_MASK DesiredAccess, @@ -453,7 +453,7 @@ * @unimplemented */ NTSTATUS -STDCALL +NTAPI NtQueryInformationJobObject ( HANDLE JobHandle, JOBOBJECTINFOCLASS JobInformationClass, @@ -470,7 +470,7 @@ * @unimplemented */ NTSTATUS -STDCALL +NTAPI NtSetInformationJobObject ( HANDLE JobHandle, JOBOBJECTINFOCLASS JobInformationClass, @@ -486,7 +486,7 @@ * @unimplemented */ NTSTATUS -STDCALL +NTAPI NtTerminateJobObject ( HANDLE JobHandle, NTSTATUS ExitStatus ) @@ -523,7 +523,7 @@ * @implemented */ PVOID -STDCALL +NTAPI PsGetJobLock ( PEJOB Job ) { ASSERT(Job); @@ -535,7 +535,7 @@ * @implemented */ PVOID -STDCALL +NTAPI PsGetJobSessionId ( PEJOB Job ) { ASSERT(Job); @@ -547,7 +547,7 @@ * @implemented */ ULONG -STDCALL +NTAPI PsGetJobUIRestrictionsClass ( PEJOB Job ) { ASSERT(Job); @@ -559,7 +559,7 @@ * @unimplemented */ VOID -STDCALL +NTAPI PsSetJobUIRestrictionsClass(PEJOB Job, ULONG UIRestrictionsClass) {
16 years, 2 months
1
0
0
0
← Newer
1
...
39
40
41
42
43
44
45
...
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