ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
June 2017
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
20 participants
526 discussions
Start a n
N
ew thread
[mjansen] 75201: [APPHELP_APITEST:db] Fix the test for Win10, use WCHAR for data paths
by mjansen@svn.reactos.org
Author: mjansen Date: Mon Jun 26 10:26:57 2017 New Revision: 75201 URL:
http://svn.reactos.org/svn/reactos?rev=75201&view=rev
Log: [APPHELP_APITEST:db] Fix the test for Win10, use WCHAR for data paths Modified: trunk/reactos/dll/appcompat/apphelp/sdbwrite.c trunk/reactos/dll/appcompat/apphelp/sdbwrite.h trunk/rostests/apitests/apphelp/apphelp.c trunk/rostests/apitests/apphelp/apphelp_apitest.h trunk/rostests/apitests/apphelp/data.c trunk/rostests/apitests/apphelp/db.cpp Modified: trunk/reactos/dll/appcompat/apphelp/sdbwrite.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/sdbw…
============================================================================== --- trunk/reactos/dll/appcompat/apphelp/sdbwrite.c [iso-8859-1] (original) +++ trunk/reactos/dll/appcompat/apphelp/sdbwrite.c [iso-8859-1] Mon Jun 26 10:26:57 2017 @@ -270,7 +270,7 @@ * * @return TRUE if it succeeds, FALSE if it fails. */ -BOOL WINAPI SdbWriteBinaryTag(PDB db, TAG tag, BYTE* data, DWORD size) +BOOL WINAPI SdbWriteBinaryTag(PDB db, TAG tag, const BYTE* data, DWORD size) { if (!SdbpCheckTagType(tag, TAG_TYPE_BINARY)) return FALSE; Modified: trunk/reactos/dll/appcompat/apphelp/sdbwrite.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/sdbw…
============================================================================== --- trunk/reactos/dll/appcompat/apphelp/sdbwrite.h [iso-8859-1] (original) +++ trunk/reactos/dll/appcompat/apphelp/sdbwrite.h [iso-8859-1] Mon Jun 26 10:26:57 2017 @@ -32,7 +32,7 @@ BOOL WINAPI SdbWriteQWORDTag(PDB db, TAG tag, QWORD data); BOOL WINAPI SdbWriteStringTag(PDB db, TAG tag, LPCWSTR string); BOOL WINAPI SdbWriteStringRefTag(PDB db, TAG tag, TAGID tagid); -BOOL WINAPI SdbWriteBinaryTag(PDB db, TAG tag, BYTE* data, DWORD size); +BOOL WINAPI SdbWriteBinaryTag(PDB db, TAG tag, const BYTE* data, DWORD size); BOOL WINAPI SdbWriteBinaryTagFromFile(PDB db, TAG tag, LPCWSTR path); TAGID WINAPI SdbBeginWriteListTag(PDB db, TAG tag); BOOL WINAPI SdbEndWriteListTag(PDB db, TAGID tagid); Modified: trunk/rostests/apitests/apphelp/apphelp.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/apphelp/apphelp.…
============================================================================== --- trunk/rostests/apitests/apphelp/apphelp.c [iso-8859-1] (original) +++ trunk/rostests/apitests/apphelp/apphelp.c [iso-8859-1] Mon Jun 26 10:26:57 2017 @@ -603,7 +603,7 @@ DWORD num = 333; BOOL ret; - test_create_file_imp("testxx.exe", crc_test, len); + test_create_file_imp(L"testxx.exe", crc_test, len); ret = pSdbGetFileAttributes(path, &pattrinfo, &num); winetest_ok(ret != FALSE, "expected SdbGetFileAttributes to succeed.\n"); winetest_ok(pattrinfo != (PATTRINFO)0xdead, "expected a valid pointer.\n"); @@ -629,7 +629,7 @@ for (n = 0; n < len; ++n) crc_test[n] = (char)(fill ? fill : n); - test_create_file_imp("testxx.exe", crc_test, len); + test_create_file_imp(L"testxx.exe", crc_test, len); free(crc_test); ret = pSdbGetFileAttributes(path, &pattrinfo, &num); winetest_ok(ret != FALSE, "expected SdbGetFileAttributes to succeed.\n"); @@ -678,7 +678,7 @@ pSdbFreeFileAttributes(pattrinfo); /* Test a file with as much features as possible */ - test_create_exe("testxx.exe", 0); + test_create_exe(L"testxx.exe", 0); ret = pSdbGetFileAttributes(path, &pattrinfo, &num); ok(ret != FALSE, "expected SdbGetFileAttributes to succeed.\n"); @@ -721,7 +721,7 @@ /* Disable resource and exports */ - test_create_exe("testxx.exe", 1); + test_create_exe(L"testxx.exe", 1); ret = pSdbGetFileAttributes(path, &pattrinfo, &num); ok(ret != FALSE, "expected SdbGetFileAttributes to succeed.\n"); @@ -747,7 +747,7 @@ pSdbFreeFileAttributes(pattrinfo); /* A file with just 'MZ' */ - test_create_file("testxx.exe", "MZ", 2); + test_create_file(L"testxx.exe", "MZ", 2); ret = pSdbGetFileAttributes(path, &pattrinfo, &num); ok(ret != FALSE, "expected SdbGetFileAttributes to succeed.\n"); @@ -768,7 +768,7 @@ pSdbFreeFileAttributes(pattrinfo); /* Empty file */ - test_create_file("testxx.exe", NULL, 0); + test_create_file(L"testxx.exe", NULL, 0); ret = pSdbGetFileAttributes(path, &pattrinfo, &num); ok(ret != FALSE, "expected SdbGetFileAttributes to succeed.\n"); @@ -786,7 +786,7 @@ pSdbFreeFileAttributes(pattrinfo); /* minimal NE executable */ - test_create_ne("testxx.exe", 0); + test_create_ne(L"testxx.exe", 0); ret = pSdbGetFileAttributes(path, &pattrinfo, &num); ok(ret != FALSE, "expected SdbGetFileAttributes to succeed.\n"); @@ -811,7 +811,7 @@ pSdbFreeFileAttributes(pattrinfo); /* NE executable with description / module name pointers zero, to show they are always used */ - test_create_ne("testxx.exe", 1); + test_create_ne(L"testxx.exe", 1); ret = pSdbGetFileAttributes(path, &pattrinfo, &num); ok(ret != FALSE, "expected SdbGetFileAttributes to succeed.\n"); Modified: trunk/rostests/apitests/apphelp/apphelp_apitest.h URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/apphelp/apphelp_…
============================================================================== --- trunk/rostests/apitests/apphelp/apphelp_apitest.h [iso-8859-1] (original) +++ trunk/rostests/apitests/apphelp/apphelp_apitest.h [iso-8859-1] Mon Jun 26 10:26:57 2017 @@ -7,11 +7,11 @@ /* data.c */ -void test_create_db_imp(const char* name, int win10); +void test_create_db_imp(const WCHAR* name, int win10); DWORD test_get_db_size(); -void test_create_exe_imp(const char* name, int skip_rsrc_exports); -void test_create_file_imp(const char* name, const char* contents, size_t len); -void test_create_ne_imp(const char* name, int skip_names); +void test_create_exe_imp(const WCHAR* name, int skip_rsrc_exports); +void test_create_file_imp(const WCHAR* name, const char* contents, size_t len); +void test_create_ne_imp(const WCHAR* name, int skip_names); DWORD get_host_winver(void); DWORD get_module_version(HMODULE mod); void silence_debug_output(void); // Silence output if the environment variable is not set. Modified: trunk/rostests/apitests/apphelp/data.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/apphelp/data.c?r…
============================================================================== --- trunk/rostests/apitests/apphelp/data.c [iso-8859-1] (original) +++ trunk/rostests/apitests/apphelp/data.c [iso-8859-1] Mon Jun 26 10:26:57 2017 @@ -474,14 +474,14 @@ }; -void test_create_exe_imp(const char* name, int skip_rsrc_exports) +void test_create_exe_imp(const WCHAR* name, int skip_rsrc_exports) { HANDLE file; char *buf, *cur; DWORD size = 0x800; buf = malloc(size); - file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + file = CreateFileW(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); winetest_ok(file != INVALID_HANDLE_VALUE, "can't create file\n"); if(file == INVALID_HANDLE_VALUE) return; @@ -522,7 +522,7 @@ /* Almost everything in this filetype is ignored, only e_lfanew, ne_restab and ne_nrestab are relevant */ -void test_create_ne_imp(const char* name, int skip_names) +void test_create_ne_imp(const WCHAR* name, int skip_names) { HANDLE file; DWORD size; @@ -535,7 +535,7 @@ 20,'M','O','D',' ','D','E','S','C','R','I','P','T','I','O','N',' ','H','E','R','E',0,0,0 }; - file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + file = CreateFileW(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); winetest_ok(file != INVALID_HANDLE_VALUE, "can't create file\n"); if(file == INVALID_HANDLE_VALUE) return; @@ -554,9 +554,9 @@ CloseHandle(file); } -void test_create_file_imp(const char* name, const char* contents, size_t len) -{ - HANDLE file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); +void test_create_file_imp(const WCHAR* name, const char* contents, size_t len) +{ + HANDLE file = CreateFileW(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); winetest_ok(file != INVALID_HANDLE_VALUE, "can't create file\n"); if (file != INVALID_HANDLE_VALUE) { @@ -777,10 +777,10 @@ return sizeof(rawData); } -void test_create_db_imp(const char* name, int win10) -{ - HANDLE file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - winetest_ok(file != INVALID_HANDLE_VALUE, "can't create file '%s'\n", name); +void test_create_db_imp(const WCHAR* name, int win10) +{ + HANDLE file = CreateFileW(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + winetest_ok(file != INVALID_HANDLE_VALUE, "can't create file '%s'\n", wine_dbgstr_w(name)); if (file != INVALID_HANDLE_VALUE) { DWORD size; Modified: trunk/rostests/apitests/apphelp/db.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/apphelp/db.cpp?r…
============================================================================== --- trunk/rostests/apitests/apphelp/db.cpp [iso-8859-1] (original) +++ trunk/rostests/apitests/apphelp/db.cpp [iso-8859-1] Mon Jun 26 10:26:57 2017 @@ -1,7 +1,7 @@ /* * Copyright 2012 Detlef Riekenberg * Copyright 2013 Mislav BlaževiÄ - * Copyright 2015,2016 Mark Jansen + * Copyright 2015-2017 Mark Jansen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -318,7 +318,11 @@ /* FIXME: doesnt work on win10?! */ pdb = pSdbOpenDatabase(path1, DOS_PATH); - ok(pdb != NULL, "unexpected NULL handle\n"); + if (g_WinVersion < WINVER_WIN10) + { + /* ERROR,SdbOpenDatabaseEx,845,Failed to open SDB - File size too large or small. */ + ok(pdb != NULL, "unexpected NULL handle\n"); + } if (pdb) { binary = (PBYTE)pSdbGetBinaryTagData(pdb, _TAGID_ROOT); @@ -545,7 +549,7 @@ } } -static void match_str_attr_imp(PDB pdb, TAGID parent, TAG find, const char* compare) +static void match_strw_attr_imp(PDB pdb, TAGID parent, TAG find, const WCHAR* compare) { TAGID attr = pSdbFindFirstTag(pdb, parent, find); winetest_ok(attr != TAG_NULL, "Could not find: %x\n", find); @@ -555,9 +559,7 @@ winetest_ok(name != NULL, "Could not convert attr to str.\n"); if (name) { - char name_a[100]; - WideCharToMultiByte(CP_ACP, 0, name, -1, name_a, sizeof(name_a), NULL, NULL); - winetest_ok(strcmp(name_a, compare) == 0, "Expected tagid %x to be %s, was %s\n", attr, compare, name_a); + winetest_ok(wcscmp(name, compare) == 0, "Expected tagid %x to be %s, was %s\n", attr, wine_dbgstr_w(compare), wine_dbgstr_w(name)); } } } @@ -597,7 +599,7 @@ } } -#define match_str_attr (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : match_str_attr_imp +#define match_strw_attr (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : match_strw_attr_imp #define match_dw_attr (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : match_dw_attr_imp #define match_qw_attr (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : match_qw_attr_imp #define match_guid_attr (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : match_guid_attr_imp @@ -631,8 +633,8 @@ } } match_qw_attr(pdb, root, TAG_TIME, 0x1d1b91a02c0d63e); - match_str_attr(pdb, root, TAG_COMPILER_VERSION, "2.1.0.3"); - match_str_attr(pdb, root, TAG_NAME, "apphelp_test1"); + match_strw_attr(pdb, root, TAG_COMPILER_VERSION, L"2.1.0.3"); + match_strw_attr(pdb, root, TAG_NAME, L"apphelp_test1"); match_dw_attr(pdb, root, TAG_OS_PLATFORM, 1); } @@ -643,14 +645,14 @@ if (!layer) return; - match_str_attr(pdb, layer, TAG_NAME, "TestNewMode"); + match_strw_attr(pdb, layer, TAG_NAME, L"TestNewMode"); shimref = pSdbFindFirstTag(pdb, layer, TAG_SHIM_REF); ok(shimref != TAGID_NULL, "Expected a valid shim ref, got NULL\n"); if (!shimref) return; - match_str_attr(pdb, shimref, TAG_NAME, "VirtualRegistry"); - match_str_attr(pdb, shimref, TAG_COMMAND_LINE, "ThemeActive"); + match_strw_attr(pdb, shimref, TAG_NAME, L"VirtualRegistry"); + match_strw_attr(pdb, shimref, TAG_COMMAND_LINE, L"ThemeActive"); inexclude = pSdbFindFirstTag(pdb, shimref, TAG_INEXCLUD); ok(inexclude != TAGID_NULL, "Expected a valid in/exclude ref, got NULL\n"); if (!inexclude) @@ -658,7 +660,7 @@ is_include = pSdbFindFirstTag(pdb, inexclude, TAG_INCLUDE); ok(is_include == TAGID_NULL, "Expected a NULL include ref, but got one anyway.\n"); - match_str_attr(pdb, inexclude, TAG_MODULE, "exclude.dll"); + match_strw_attr(pdb, inexclude, TAG_MODULE, L"exclude.dll"); inexclude = pSdbFindNextTag(pdb, shimref, inexclude); ok(inexclude != TAGID_NULL, "Expected a valid in/exclude ref, got NULL\n"); @@ -667,7 +669,7 @@ is_include = pSdbFindFirstTag(pdb, inexclude, TAG_INCLUDE); ok(is_include != TAGID_NULL, "Expected a valid include ref, got NULL\n"); - match_str_attr(pdb, inexclude, TAG_MODULE, "include.dll"); + match_strw_attr(pdb, inexclude, TAG_MODULE, L"include.dll"); } static void check_matching_file(PDB pdb, TAGID exe, TAGID matching_file, int num) @@ -681,11 +683,11 @@ return; - match_str_attr(pdb, matching_file, TAG_NAME, "*"); - match_str_attr(pdb, matching_file, TAG_COMPANY_NAME, "CompanyName"); - match_str_attr(pdb, matching_file, TAG_PRODUCT_NAME, "ProductName"); - match_str_attr(pdb, matching_file, TAG_PRODUCT_VERSION, "1.0.0.1"); - match_str_attr(pdb, matching_file, TAG_FILE_VERSION, "1.0.0.0"); + match_strw_attr(pdb, matching_file, TAG_NAME, L"*"); + match_strw_attr(pdb, matching_file, TAG_COMPANY_NAME, L"CompanyName"); + match_strw_attr(pdb, matching_file, TAG_PRODUCT_NAME, L"ProductName"); + match_strw_attr(pdb, matching_file, TAG_PRODUCT_VERSION, L"1.0.0.1"); + match_strw_attr(pdb, matching_file, TAG_FILE_VERSION, L"1.0.0.0"); if (num == 0 || num == 3) { @@ -705,14 +707,14 @@ { match_dw_attr(pdb, matching_file, TAG_SIZE, 0x800); match_dw_attr(pdb, matching_file, TAG_CHECKSUM, 0x178bd629); - match_str_attr(pdb, matching_file, TAG_FILE_DESCRIPTION, "FileDescription"); + match_strw_attr(pdb, matching_file, TAG_FILE_DESCRIPTION, L"FileDescription"); match_dw_attr(pdb, matching_file, TAG_MODULE_TYPE, 3); match_dw_attr(pdb, matching_file, TAG_VERFILEOS, 4); match_dw_attr(pdb, matching_file, TAG_VERFILETYPE, 1); match_dw_attr(pdb, matching_file, TAG_LINKER_VERSION, 0x40002); - match_str_attr(pdb, matching_file, TAG_ORIGINAL_FILENAME, "OriginalFilename"); - match_str_attr(pdb, matching_file, TAG_INTERNAL_NAME, "InternalName"); - match_str_attr(pdb, matching_file, TAG_LEGAL_COPYRIGHT, "LegalCopyright"); + match_strw_attr(pdb, matching_file, TAG_ORIGINAL_FILENAME, L"OriginalFilename"); + match_strw_attr(pdb, matching_file, TAG_INTERNAL_NAME, L"InternalName"); + match_strw_attr(pdb, matching_file, TAG_LEGAL_COPYRIGHT, L"LegalCopyright"); match_dw_attr(pdb, matching_file, TAG_LINK_DATE, 0x12345); match_dw_attr(pdb, matching_file, TAG_UPTO_LINK_DATE, 0x12345); } @@ -724,7 +726,7 @@ if (num == 2) { ok(matching_file != TAGID_NULL, "Did expect a secondary match on %d\n", num); - match_str_attr(pdb, matching_file, TAG_NAME, "test_checkfile.txt"); + match_strw_attr(pdb, matching_file, TAG_NAME, L"test_checkfile.txt"); match_dw_attr(pdb, matching_file, TAG_SIZE, 0x4); match_dw_attr(pdb, matching_file, TAG_CHECKSUM, 0xb0b0b0b0); } @@ -790,23 +792,23 @@ if (num == 2) { match_dw_attr(pdb, layer, TAG_LAYER_TAGID, 0x18e); - match_str_attr(pdb, layer, TAG_NAME, "TestNewMode"); + match_strw_attr(pdb, layer, TAG_NAME, L"TestNewMode"); } else { TAGID layer_tagid = pSdbFindFirstTag(pdb, layer, TAG_LAYER_TAGID); ok(layer_tagid == TAGID_NULL, "expected not to find a layer tagid, got %x\n", layer_tagid); - match_str_attr(pdb, layer, TAG_NAME, "WinSrv03"); + match_strw_attr(pdb, layer, TAG_NAME, L"WinSrv03"); } } static struct { - const char* name; - const char* app_name; - const char* vendor; + const WCHAR* name; + const WCHAR* app_name; + const WCHAR* vendor; GUID exe_id; - const char* extra_file; + const WCHAR* extra_file; DWORD dwLayerCount; TAGREF atrExes_0; DWORD adwExeFlags_0; @@ -815,9 +817,9 @@ const char* env_var; } test_exedata[5] = { { - "test_allow.exe", - "apphelp_name_allow", - "apphelp_vendor_allow", + L"test_allow.exe", + L"apphelp_name_allow", + L"apphelp_vendor_allow", { 0x4e50c93f, 0xb863, 0x4dfa, { 0xba, 0xe2, 0xd8, 0x0e, 0xf4, 0xce, 0x5c, 0x89 } }, NULL, 0, @@ -828,9 +830,9 @@ NULL, }, { - "test_disallow.exe", - "apphelp_name_disallow", - "apphelp_vendor_disallow", + L"test_disallow.exe", + L"apphelp_name_disallow", + L"apphelp_vendor_disallow", { 0x156720e1, 0xef98, 0x4d04, { 0x96, 0x5a, 0xd8, 0x5d, 0xe0, 0x5e, 0x6d, 0x9f } }, NULL, 0, @@ -841,11 +843,11 @@ NULL, }, { - "test_new.exe", - "fixnew_name", - "fixnew_vendor", + L"test_new.exe", + L"fixnew_name", + L"fixnew_vendor", { 0xce70ef69, 0xa21d, 0x408b, { 0x84, 0x5b, 0xf9, 0x9e, 0xac, 0x06, 0x09, 0xe7 } }, - "test_checkfile.txt", + L"test_checkfile.txt", 1, 0x2ec, 0, @@ -854,9 +856,9 @@ NULL, }, { - "test_w2k3.exe", - "fix_name", - "fix_vendor", + L"test_w2k3.exe", + L"fix_name", + L"fix_vendor", { 0xb4ead144, 0xf640, 0x4e4b, { 0x94, 0xc4, 0x0c, 0x7f, 0xa8, 0x66, 0x23, 0xb0 } }, NULL, 0, @@ -867,9 +869,9 @@ NULL, }, { - "test_unknown_file.exe", - "apphelp_name_allow", - "apphelp_vendor_allow", + L"test_unknown_file.exe", + L"apphelp_name_allow", + L"apphelp_vendor_allow", { 0x00000000, 0x0000, 0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, NULL, 1, @@ -893,9 +895,9 @@ ok(num < 4, "Too many matches, expected only 4!\n"); if (num >= 4) break; - match_str_attr(pdb, exe, TAG_NAME, test_exedata[num].name); - match_str_attr(pdb, exe, TAG_APP_NAME, test_exedata[num].app_name); - match_str_attr(pdb, exe, TAG_VENDOR, test_exedata[num].vendor); + match_strw_attr(pdb, exe, TAG_NAME, test_exedata[num].name); + match_strw_attr(pdb, exe, TAG_APP_NAME, test_exedata[num].app_name); + match_strw_attr(pdb, exe, TAG_VENDOR, test_exedata[num].vendor); match_guid_attr(pdb, exe, TAG_EXE_ID, &test_exedata[num].exe_id); check_matching_file(pdb, exe, pSdbFindFirstTag(pdb, exe, TAG_MATCHING_FILE), num); apphelp = pSdbFindFirstTag(pdb, exe, TAG_APPHELP); @@ -929,21 +931,21 @@ static struct { DWORD htmlhelpid; - const char* link; - const char* apphelp_title; - const char* apphelp_details; + const WCHAR* link; + const WCHAR* apphelp_title; + const WCHAR* apphelp_details; } test_layerdata[2] = { { 2, - "
http://reactos.org/disallow
", - "apphelp_name_disallow", - "Not allowed!", + L"
http://reactos.org/disallow
", + L"apphelp_name_disallow", + L"Not allowed!", }, { 1, - "
http://reactos.org/allow
", - "apphelp_name_allow", - "Allow it!", + L"
http://reactos.org/allow
", + L"apphelp_name_allow", + L"Allow it!", }, }; @@ -962,10 +964,10 @@ ok(link != TAGID_NULL, "expected to find a link tag\n"); if (link != TAGID_NULL) { - match_str_attr(pdb, link, TAG_LINK_URL, test_layerdata[num].link); - } - match_str_attr(pdb, apphelp, TAG_APPHELP_TITLE, test_layerdata[num].apphelp_title); - match_str_attr(pdb, apphelp, TAG_APPHELP_DETAILS, test_layerdata[num].apphelp_details); + match_strw_attr(pdb, link, TAG_LINK_URL, test_layerdata[num].link); + } + match_strw_attr(pdb, apphelp, TAG_APPHELP_TITLE, test_layerdata[num].apphelp_title); + match_strw_attr(pdb, apphelp, TAG_APPHELP_DETAILS, test_layerdata[num].apphelp_details); apphelp = pSdbFindNextTag(pdb, root, apphelp); num++; } @@ -980,7 +982,7 @@ BOOL ret; DWORD ver_hi, ver_lo; - test_create_db("test_db.sdb", g_WinVersion >= WINVER_WIN10); + test_create_db(L"test_db.sdb", g_WinVersion >= WINVER_WIN10); /* both ver_hi and ver_lo cannot be null, it'll crash. */ ver_hi = ver_lo = 0x12345678; @@ -1066,6 +1068,29 @@ } } +static BOOL IsUserAdmin() +{ + BOOL Result; + SID_IDENTIFIER_AUTHORITY NtAuthority = { SECURITY_NT_AUTHORITY }; + PSID AdministratorsGroup; + + Result = AllocateAndInitializeSid(&NtAuthority, 2, + SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_ADMINS, + 0, 0, 0, 0, 0, 0, + &AdministratorsGroup); + if (Result) + { + if (!CheckTokenMembership( NULL, AdministratorsGroup, &Result)) + Result = FALSE; + FreeSid(AdministratorsGroup); + } + + return Result; +} + + + template<typename SDBQUERYRESULT_T> static void check_adwExeFlags(DWORD adwExeFlags_0, SDBQUERYRESULT_T& query, const char* file, int line, int cur) { @@ -1081,10 +1106,9 @@ template<typename SDBQUERYRESULT_T> -static void test_mode_generic(const char* workdir, HSDB hsdb, int cur) -{ - char exename[MAX_PATH], testfile[MAX_PATH]; - WCHAR exenameW[MAX_PATH]; +static void test_mode_generic(const WCHAR* workdir, HSDB hsdb, int cur) +{ + WCHAR exename[MAX_PATH], testfile[MAX_PATH]; BOOL ret; SDBQUERYRESULT_T query; PDB pdb; @@ -1095,17 +1119,16 @@ memset(&query, 0xab, sizeof(query)); - sprintf(exename, "%s\\%s", workdir, test_exedata[cur].name); + swprintf(exename, L"%s\\%s", workdir, test_exedata[cur].name); if (test_exedata[cur].extra_file) - sprintf(testfile, "%s\\%s", workdir, test_exedata[cur].extra_file); + swprintf(testfile, L"%s\\%s", workdir, test_exedata[cur].extra_file); test_create_exe(exename, 0); - MultiByteToWideChar(CP_ACP, 0, exename, -1, exenameW, MAX_PATH); if (test_exedata[cur].extra_file) { /* First we try without the file at all. */ - DeleteFileA(testfile); - ret = pSdbGetMatchingExe(hsdb, exenameW, NULL, NULL, 0, (SDBQUERYRESULT_VISTA*)&query); + DeleteFileW(testfile); + ret = pSdbGetMatchingExe(hsdb, exename, NULL, NULL, 0, (SDBQUERYRESULT_VISTA*)&query); ok(ret == 0, "SdbGetMatchingExe should have failed for %d.\n", cur); /* Now re-try with the correct file */ test_create_file(testfile, "aaaa", 4); @@ -1113,13 +1136,13 @@ #if 0 // Results seem to be cached based on filename, until we can invalidate this, do not test the same filename twice! - DeleteFileA(exename); + DeleteFileW(exename); // skip exports test_create_exe(exename, 1); ret = pSdbGetMatchingExe(hsdb, exenameW, NULL, NULL, 0, &query); ok(ret == 0, "SdbGetMatchingExe should have failed for %d.\n", cur); - DeleteFileA(exename); + DeleteFileW(exename); test_create_exe(exename, 0); #endif @@ -1128,7 +1151,7 @@ SetEnvironmentVariableA("__COMPAT_LAYER", test_exedata[cur].env_var); } - ret = pSdbGetMatchingExe(hsdb, exenameW, NULL, NULL, 0, (SDBQUERYRESULT_VISTA*)&query); + ret = pSdbGetMatchingExe(hsdb, exename, NULL, NULL, 0, (SDBQUERYRESULT_VISTA*)&query); ok(ret, "SdbGetMatchingExe should not fail for %d.\n", cur); exe_count = (test_exedata[cur].env_var == NULL) ? 1 : 0; @@ -1147,7 +1170,11 @@ else if (g_WinVersion < WINVER_WIN10) expect_flags = 0x101; else + { expect_flags = 0x121; /* for 2 and 3, this becomes 101 when not elevated. */ + if ((cur == 2 || cur == 3) && !IsUserAdmin()) + expect_flags &= ~0x20; + } if (test_exedata[cur].env_var) expect_flags &= ~0x100; @@ -1187,7 +1214,7 @@ TAG tag = pSdbGetTagFromTagID(pdb, tagid); test_is_testdb(pdb); ok(tag == TAG_EXE, "Expected tag to be TAG_EXE, was 0x%x for %d.\n", tag, cur); - match_str_attr(pdb, tagid, TAG_NAME, test_exedata[cur].name); + match_strw_attr(pdb, tagid, TAG_NAME, test_exedata[cur].name); /* And back again */ ret = pSdbTagIDToTagRef(hsdb, pdb, tagid, &tr); @@ -1215,7 +1242,7 @@ TAG tag = pSdbGetTagFromTagID(pdb, tagid); test_is_testdb(pdb); ok(tag == TAG_LAYER, "Expected tag to be TAG_LAYER, was 0x%x for %d.\n", tag, cur); - match_str_attr(pdb, tagid, TAG_NAME, "TestNewMode"); + match_strw_attr(pdb, tagid, TAG_NAME, L"TestNewMode"); /* And back again */ ret = pSdbTagIDToTagRef(hsdb, pdb, tagid, &tr); @@ -1236,17 +1263,26 @@ - if (RtlDosPathNameToNtPathName_U(exenameW, &exenameNT, NULL, NULL)) + if (RtlDosPathNameToNtPathName_U(exename, &exenameNT, NULL, NULL)) { ret = pSdbGetMatchingExe(hsdb, exenameNT.Buffer, NULL, NULL, 0, (SDBQUERYRESULT_VISTA*)&query); + if (!ret && g_WinVersion >= WINVER_WIN10) + { + /* + ERROR,AslPathGetLongFileNameLongpath,110,Long path conversion failed 123 [c0000001] + ERROR,AslPathBuildSignatureLongpath,1086,AslPathGetLongFileNameLongpath failed for \??\C:\Users\MARK~1.DEV\AppData\Local\Temp\apphelp_test\test_allow.exe [c0000001] + */ + trace("Using DOS path for Win10\n"); + ret = pSdbGetMatchingExe(hsdb, exename, NULL, NULL, 0, (SDBQUERYRESULT_VISTA*)&query); + } ok(ret, "SdbGetMatchingExe should not fail for %d.\n", cur); RtlFreeUnicodeString(&exenameNT); } if (test_exedata[cur].extra_file) - DeleteFileA(testfile); - DeleteFileA(exename); + DeleteFileW(testfile); + DeleteFileW(exename); if (test_exedata[cur].env_var) { @@ -1257,25 +1293,23 @@ template<typename SDBQUERYRESULT_T> static void test_MatchApplications(void) { - char workdir[MAX_PATH], dbpath[MAX_PATH]; - WCHAR dbpathW[MAX_PATH]; + WCHAR workdir[MAX_PATH], dbpath[MAX_PATH]; BOOL ret; HSDB hsdb; - ret = GetTempPathA(MAX_PATH, workdir); - ok(ret, "GetTempPathA error: %d\n", GetLastError()); - lstrcatA(workdir, "apphelp_test"); - - ret = CreateDirectoryA(workdir, NULL); - ok(ret, "CreateDirectoryA error: %d\n", GetLastError()); + ret = GetTempPathW(_countof(workdir), workdir); + ok(ret, "GetTempPathW error: %d\n", GetLastError()); + wcscat(workdir, L"apphelp_test"); + + ret = CreateDirectoryW(workdir, NULL); + ok(ret, "CreateDirectoryW error: %d\n", GetLastError()); /* SdbInitDatabase needs an nt-path */ - sprintf(dbpath, "\\??\\%s\\test.sdb", workdir); + swprintf(dbpath, L"\\??\\%s\\test.sdb", workdir); test_create_db(dbpath + 4, g_WinVersion >= WINVER_WIN10); - MultiByteToWideChar(CP_ACP, 0, dbpath, -1, dbpathW, MAX_PATH); - hsdb = pSdbInitDatabase(HID_DATABASE_FULLPATH, dbpathW); + hsdb = pSdbInitDatabase(HID_DATABASE_FULLPATH, dbpath); ok(hsdb != NULL, "Expected a valid database handle\n"); @@ -1292,16 +1326,15 @@ pSdbReleaseDatabase(hsdb); } - DeleteFileA(dbpath + 4); - - ret = RemoveDirectoryA(workdir); - ok(ret, "RemoveDirectoryA error: %d\n", GetLastError()); + DeleteFileW(dbpath + 4); + + ret = RemoveDirectoryW(workdir); + ok(ret, "RemoveDirectoryW error: %d\n", GetLastError()); } static void test_TagRef(void) { - char tmpdir[MAX_PATH], dbpath[MAX_PATH]; - WCHAR dbpathW[MAX_PATH]; + WCHAR tmpdir[MAX_PATH], dbpath[MAX_PATH]; BOOL ret; HSDB hsdb; PDB pdb; @@ -1309,16 +1342,15 @@ DWORD size; TAGREF tr; - ret = GetTempPathA(MAX_PATH, tmpdir); + ret = GetTempPathW(_countof(tmpdir), tmpdir); ok(ret, "GetTempPathA error: %d\n", GetLastError()); /* SdbInitDatabase needs an nt-path */ - sprintf(dbpath, "\\??\\%stest.sdb", tmpdir); + swprintf(dbpath, L"\\??\\%stest.sdb", tmpdir); test_create_db(dbpath + 4, g_WinVersion >= WINVER_WIN10); - MultiByteToWideChar(CP_ACP, 0, dbpath, -1, dbpathW, MAX_PATH); - hsdb = pSdbInitDatabase(HID_DATABASE_FULLPATH, dbpathW); + hsdb = pSdbInitDatabase(HID_DATABASE_FULLPATH, dbpath); /* HSDB is the only arg that can't be null */ ret = pSdbTagRefToTagID(hsdb, 0, NULL, NULL); @@ -1437,7 +1469,7 @@ pSdbReleaseDatabase(hsdb); - DeleteFileA(dbpath + 4); + DeleteFileW(dbpath + 4); }
7 years, 6 months
1
0
0
0
[rgampa] 75200: [USBXHCI] -defined TRBs for command and control -allocated resources to the driver. -intiated command ring -intiated DCBAA -changed XHCI_InitializeSchedule function to XHCI_Initiali...
by rgampa@svn.reactos.org
Author: rgampa Date: Mon Jun 26 06:14:59 2017 New Revision: 75200 URL:
http://svn.reactos.org/svn/reactos?rev=75200&view=rev
Log: [USBXHCI] -defined TRBs for command and control -allocated resources to the driver. -intiated command ring -intiated DCBAA -changed XHCI_InitializeSchedule function to XHCI_InitializeResources. CORE-13344 Modified: branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/hardware.h branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/usbxhci.c branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/usbxhci.h Modified: branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/hardware.h URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/usbxhci/reactos/drive…
============================================================================== --- branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/hardware.h [iso-8859-1] (original) +++ branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/hardware.h [iso-8859-1] Mon Jun 26 06:14:59 2017 @@ -14,12 +14,14 @@ #define XHCI_DCBAAP 12 #define XHCI_CONFIG 14 +typedef unsigned long long ULONGULONG ; + typedef union _XHCI_HC_STRUCTURAL_PARAMS_1 { struct { - ULONG NumberOfDeviceSlots : 8; - ULONG NumberOfInterrupters : 11; + ULONG NumberOfDeviceSlots : 8; // MAXSLOTS + ULONG NumberOfInterrupters : 11; // MAXINTRS ULONG Rsvd : 5; - ULONG NumberOfPorts : 8; + ULONG NumberOfPorts : 8; //MAXPORTS }; ULONG AsULONG; } XHCI_HC_STRUCTURAL_PARAMS_1; @@ -149,10 +151,10 @@ typedef union _XHCI_CONFIGURE { struct { - ULONG MaxDeviceSlot : 8; - ULONG U3E : 1; - ULONG CIE : 1; - ULONG Rsvd : 21; + ULONG MaxDeviceSlotsEnabled : 8; + ULONG U3EntryEnable : 1; + ULONG ConfigurationInfoEnable : 1; + ULONG Rsvd : 21; }; ULONG AsULONG; } XHCI_CONFIGURE; @@ -187,25 +189,25 @@ ULONG AsULONG; } XHCI_PORT_STATUS_CONTROL; -typedef union _XHCI_COMMAND_RING_CONTROL { //typedef ulongulong for better readability - struct { - unsigned long long RCS : 1; - unsigned long long CS : 1; - unsigned long long CA : 1; - unsigned long long CRR : 1; - unsigned long long Rsvd : 2; - unsigned long long CommandRingPointerLo : 26; - unsigned long long CommandRingPointerHi : 32; - }; - unsigned long long AsULONGULONG; +typedef union _XHCI_COMMAND_RING_CONTROL { + struct { + ULONGULONG RingCycleState : 1; + ULONGULONG CommandStop : 1; + ULONGULONG CommandAbort : 1; + ULONGULONG CommandRingRunning : 1; + ULONGULONG RsvdP : 2; + ULONGULONG CommandRingPointerLo : 26; + ULONGULONG CommandRingPointerHi : 32; + }; + ULONGULONG AsULONGULONG; } XHCI_COMMAND_RING_CONTROL; -typedef union _XHCI_DEVICE_CONTEXT_BASE_ADD_ARRAY { - struct { - unsigned long long Rsvd : 6; - unsigned long long DCBAALo : 26; - unsigned long long DCBAAHi : 32; - }; - unsigned long long AsULONGULONG; -} XHCI_DEVICE_CONTEXT_BASE_ADD_ARRAY; - +typedef union _XHCI_DEVICE_CONTEXT_BASE_ADD_ARRAY_POINTER { + struct { + ULONGULONG RsvdZ : 6; + ULONGULONG DCBAAPointerLo : 26; + ULONGULONG DCBAAPointerHi : 32; + }; + ULONGULONG AsULONGULONG; +} XHCI_DEVICE_CONTEXT_BASE_ADD_ARRAY_POINTER; + Modified: branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/usbxhci.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/usbxhci/reactos/drive…
============================================================================== --- branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/usbxhci.c [iso-8859-1] (original) +++ branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/usbxhci.c [iso-8859-1] Mon Jun 26 06:14:59 2017 @@ -46,10 +46,59 @@ MPSTATUS NTAPI -XHCI_InitializeSchedule(IN PXHCI_EXTENSION XhciExtension, +XHCI_InitializeResources(IN PXHCI_EXTENSION XhciExtension, IN PVOID resourcesStartVA, IN PVOID resourcesStartPA) { + PXHCI_HC_RESOURCES HcResourcesVA; + PHYSICAL_ADDRESS HcResourcesPA; + + XHCI_COMMAND_RING_CONTROL CommandRingControlRegister; + + XHCI_DEVICE_CONTEXT_BASE_ADD_ARRAY_POINTER DCBAAPointer; + PULONG OperationalRegs; + unsigned long X, Y; + + DPRINT_XHCI("XHCI_InitializeResources: BaseVA - %p, BasePA - %p\n", + resourcesStartVA, + resourcesStartPA); + + HcResourcesVA = (PXHCI_HC_RESOURCES)resourcesStartVA; + HcResourcesPA.QuadPart = (ULONG_PTR)resourcesStartPA; + + DCBAAPointer.AsULONGULONG = HcResourcesPA.QuadPart + FIELD_OFFSET(XHCI_HC_RESOURCES, DCBAA); + + OperationalRegs = XhciExtension->OperationalRegs; + //DCBAAPointer.RsvdZ =0; + WRITE_REGISTER_ULONG(OperationalRegs + XHCI_DCBAAP, DCBAAPointer.DCBAAPointerLo | DCBAAPointer.RsvdZ ); + WRITE_REGISTER_ULONG(OperationalRegs + XHCI_DCBAAP + 1, DCBAAPointer.DCBAAPointerHi); + + X = READ_REGISTER_ULONG(OperationalRegs + XHCI_DCBAAP) ; + Y = READ_REGISTER_ULONG(OperationalRegs + XHCI_DCBAAP + 1) ; + DCBAAPointer.AsULONGULONG = Y|X ; + ASSERT(DCBAAPointer.RsvdZ == 0); + + // command ring intialisation. + + HcResourcesVA->CommandRing.Segment[0].Link[0].AsULONG = 0; + HcResourcesVA->CommandRing.Segment[0].Link[1].AsULONG = 0; + HcResourcesVA->CommandRing.Segment[0].Link[2].AsULONG = 0; + HcResourcesVA->CommandRing.Segment[0].Link[3].AsULONG = 0; + + HcResourcesVA->CommandRing.CREnquePointer= &HcResourcesVA->CommandRing.Segment[0]; + HcResourcesVA->CommandRing.CRDequePointer= HcResourcesVA->CommandRing.CREnquePointer; + + CommandRingControlRegister.AsULONGULONG = HcResourcesPA.QuadPart + FIELD_OFFSET(XHCI_HC_RESOURCES, CommandRing.Segment); + ASSERT(CommandRingControlRegister.RingCycleState == 0); + ASSERT(CommandRingControlRegister.CommandStop == 0); + ASSERT(CommandRingControlRegister.CommandAbort == 0); + ASSERT(CommandRingControlRegister.CommandRingRunning == 0); + ASSERT(CommandRingControlRegister.RsvdP == 0); + + WRITE_REGISTER_ULONG(OperationalRegs + XHCI_CRCR, CommandRingControlRegister.AsULONGULONG); + WRITE_REGISTER_ULONG(OperationalRegs + XHCI_CRCR + 1, CommandRingControlRegister.CommandRingPointerHi); + + DbgBreakPoint(); return MP_STATUS_SUCCESS; } @@ -64,8 +113,9 @@ LARGE_INTEGER CurrentTime = {{0, 0}}; LARGE_INTEGER LastTime = {{0, 0}}; XHCI_HC_STRUCTURAL_PARAMS_1 StructuralParams_1; - - DPRINT1("EHCI_InitializeHardware: ... \n"); + XHCI_CONFIGURE Config; + + DPRINT1("XHCI_InitializeHardware: ... \n"); OperationalRegs = XhciExtension->OperationalRegs; BaseIoAdress = XhciExtension->BaseIoAdress; @@ -79,6 +129,7 @@ Command.AsULONG = READ_REGISTER_ULONG(OperationalRegs + XHCI_USBCMD); Command.HCReset = 1; + WRITE_REGISTER_ULONG(OperationalRegs + XHCI_USBCMD, Command.AsULONG); while(TRUE) { KeQuerySystemTime(&LastTime); @@ -94,19 +145,27 @@ { if (Command.HCReset == 1) { - DPRINT1("EHCI_InitializeHardware: Software Reset failed!\n"); + DPRINT1("XHCI_InitializeHardware: Software Reset failed!\n"); return 7; } break; } } - DPRINT("EHCI_InitializeHardware: Reset - OK\n"); + DPRINT("XHCI_InitializeHardware: Reset - OK\n"); StructuralParams_1.AsULONG = READ_REGISTER_ULONG(BaseIoAdress + XHCI_HCSP1); // HCSPARAMS1 register XhciExtension->NumberOfPorts = StructuralParams_1.NumberOfPorts; - //EhciExtension->PortPowerControl = StructuralParams.PortPowerControl; + + Command.AsULONG = READ_REGISTER_ULONG(OperationalRegs + XHCI_USBCMD); + Config.AsULONG = READ_REGISTER_ULONG(OperationalRegs + XHCI_CONFIG); + ASSERT(Command.RunStop==0); //required before setting max device slots enabled. + Config.MaxDeviceSlotsEnabled = 1; // max possible value is number of slots HCSPARAMS1 + WRITE_REGISTER_ULONG(OperationalRegs + XHCI_CONFIG, Config.AsULONG); + // Device Context base aaddress array to be defined + // Commnad ring deque pointer to be defined in CRCR + DbgBreakPoint(); return MP_STATUS_SUCCESS; } @@ -162,7 +221,7 @@ return MPStatus; } - MPStatus = XHCI_InitializeSchedule(XhciExtension, + MPStatus = XHCI_InitializeResources(XhciExtension, Resources->StartVA, Resources->StartPA); Modified: branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/usbxhci.h URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/usbxhci/reactos/drive…
============================================================================== --- branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/usbxhci.h [iso-8859-1] (original) +++ branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/usbxhci.h [iso-8859-1] Mon Jun 26 06:14:59 2017 @@ -13,6 +13,156 @@ extern USBPORT_REGISTRATION_PACKET RegPacket; + +//Data structures +typedef struct _XHCI_DEVICE_CONTEXT_BASE_ADD_ARRAY { + PHYSICAL_ADDRESS ContextBaseAddr [256]; +} XHCI_DEVICE_CONTEXT_BASE_ADD_ARRAY, *PXHCI_DEVICE_CONTEXT_BASE_ADD_ARRAY; +//----------------------------------------LINK TRB-------------------------------------------------------------------- +typedef union _XHCI_LINK_TRB{ + struct { + ULONG RsvdZ1 : 4; + ULONG RingSegmentPointerLo : 28; + }; + struct { + ULONG RingSegmentPointerHi : 32; + }; + struct { + ULONG RsvdZ2 : 22; + ULONG InterrupterTarget : 10; + }; + struct { + ULONG CycleBit : 1; + ULONG ToggleCycle : 1; + ULONG RsvdZ3 : 2; + ULONG ChainBit : 1; + ULONG InterruptOnCompletion : 1; + ULONG RsvdZ4 : 4; + ULONG TRBType : 6; + ULONG RsvdZ5 : 16; + }; + ULONG AsULONG; +} XHCI_LINK_TRB; +//----------------------------------------Command TRBs---------------------------------------------------------------- +typedef union _XHCI_COMMAND_NO_OP_TRB { + struct { + ULONG RsvdZ1 : 5; + }; + struct { + ULONG RsvdZ2 : 5; + }; + struct { + ULONG RsvdZ3 : 5; + }; + struct { + ULONG CycleBit : 1; + ULONG RsvdZ4 : 4; + ULONG TRBType : 6; + ULONG RsvdZ5 : 14; + }; + ULONG AsULONG; +} XHCI_COMMAND_NO_OP_TRB; + +typedef union _XHCI_COMMAND_TRB { + XHCI_COMMAND_NO_OP_TRB NoOperation[4]; + XHCI_LINK_TRB Link[4]; +}XHCI_COMMAND_TRB, *PXHCI_COMMAND_TRB; + +typedef struct _XHCI_COMMAND_RING { + XHCI_COMMAND_TRB Segment[4]; + PXHCI_COMMAND_TRB CREnquePointer; + PXHCI_COMMAND_TRB CRDequePointer; +} XHCI_COMMAND_RING; +//----------------------------------------CONTROL TRANSFER DATA STRUCTUERS-------------------------------------------- + +typedef union _XHCI_CONTROL_SETUP_TRB { + struct { + ULONG bmRequestType : 8; + ULONG bRequest : 8; + ULONG wValue : 16; + }; + struct { + ULONG wIndex : 16; + ULONG wLength : 16; + }; + struct { + ULONG TRBTransferLength : 17; + ULONG RsvdZ : 5; + ULONG InterrupterTarget : 10; + }; + struct { + ULONG CycleBit : 1; + ULONG RsvdZ1 : 4; + ULONG InterruptOnCompletion : 1; + ULONG ImmediateData : 1; + ULONG RsvdZ2 : 3; + ULONG TRBType : 6; + ULONG TransferType : 2; + ULONG RsvdZ3 : 14; + }; + ULONG AsULONG; +} XHCI_CONTROL_SETUP_TRB; + +typedef union _XHCI_CONTROL_DATA_TRB { + struct { + ULONG DataBufferPointerLo : 32; + }; + struct { + ULONG DataBufferPointerHi : 32; + }; + struct { + ULONG TRBTransferLength : 17; + ULONG TDSize : 5; + ULONG InterrupterTarget : 10; + }; + struct { + ULONG CycleBit : 1; + ULONG EvaluateNextTRB : 1; + ULONG InterruptOnShortPacket : 1; + ULONG NoSnoop : 1; + ULONG ChainBit : 1; + ULONG InterruptOnCompletion : 1; + ULONG ImmediateData : 1; + ULONG RsvdZ1 : 2; + ULONG TRBType : 6; + ULONG Direction : 1; + ULONG RsvdZ2 : 15; + }; + ULONG AsULONG; +} XHCI_CONTROL_DATA_TRB; + +typedef union _XHCI_CONTROL_STATUS_TRB { + struct { + ULONG RsvdZ1 : 32; + }; + struct { + ULONG RsvdZ2 : 32; + }; + struct { + ULONG RsvdZ : 22; + ULONG InterrupterTarget : 10; + }; + struct { + ULONG CycleBit : 1; + ULONG EvaluateNextTRB : 1; + ULONG ChainBit : 2; + ULONG InterruptOnCompletion : 1; + ULONG RsvdZ3 : 4; + ULONG TRBType : 6; + ULONG Direction : 1; + ULONG RsvdZ4 : 15; + }; + ULONG AsULONG; +} XHCI_CONTROL_STATUS_TRB; + +typedef union _XHCI_CONTROL_TRB { + XHCI_CONTROL_SETUP_TRB SetupTRB[4]; + XHCI_CONTROL_DATA_TRB DataTRB[4]; + XHCI_CONTROL_STATUS_TRB StatusTRB[4]; +} XHCI_CONTROL_TRB, *PXHCI_CONTROL_TRB; + + +//------------------------------------main structs----------------------- typedef struct _XHCI_EXTENSION { ULONG Reserved; ULONG Flags; @@ -28,7 +178,8 @@ } XHCI_EXTENSION, *PXHCI_EXTENSION; typedef struct _XHCI_HC_RESOURCES { - ULONG Reserved; + XHCI_DEVICE_CONTEXT_BASE_ADD_ARRAY DCBAA; + XHCI_COMMAND_RING CommandRing; } XHCI_HC_RESOURCES, *PXHCI_HC_RESOURCES; typedef struct _XHCI_ENDPOINT { @@ -39,7 +190,6 @@ ULONG Reserved; } XHCI_TRANSFER, *PXHCI_TRANSFER; - //roothub functions VOID NTAPI
7 years, 6 months
1
0
0
0
[tthompson] 75199: [NTFS] - Add some minor fixes and improvements: Improve, add, or fix some DPRINTs. In particular, ULONG's should use %lu, not %u. Also, don't be silent about filesystem corruptio...
by tthompson@svn.reactos.org
Author: tthompson Date: Mon Jun 26 05:17:08 2017 New Revision: 75199 URL:
http://svn.reactos.org/svn/reactos?rev=75199&view=rev
Log: [NTFS] - Add some minor fixes and improvements: Improve, add, or fix some DPRINTs. In particular, ULONG's should use %lu, not %u. Also, don't be silent about filesystem corruption. NtfsFindMftRecord() - move CaseSensitive parameter before output parameter in parameter list. Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/attrib.c branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/blockdev.c branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/mft.c branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/ntfs.h branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/rw.c Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/attrib.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyst…
============================================================================== --- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/attrib.c [iso-8859-1] (original) +++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/attrib.c [iso-8859-1] Mon Jun 26 05:17:08 2017 @@ -188,8 +188,8 @@ &Current, &FirstEntry, FALSE, - &CurrentMFTIndex, - CaseSensitive); + CaseSensitive, + &CurrentMFTIndex); if (!NT_SUCCESS(Status)) break; @@ -1173,7 +1173,7 @@ while (currentOffset < IndexRootAttr->Header.TotalSizeOfEntries) { PINDEX_ENTRY_ATTRIBUTE currentIndexExtry = (PINDEX_ENTRY_ATTRIBUTE)((ULONG_PTR)IndexRootAttr + 0x10 + currentOffset); - DbgPrint(" Index Node Entry %u", currentNode++); + DbgPrint(" Index Node Entry %lu", currentNode++); if (currentIndexExtry->Flags & NTFS_INDEX_ENTRY_NODE) DbgPrint(" (Branch)"); else Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/blockdev.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyst…
============================================================================== --- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/blockdev.c [iso-8859-1] (original) +++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/blockdev.c [iso-8859-1] Mon Jun 26 05:17:08 2017 @@ -52,7 +52,7 @@ BOOLEAN AllocatedBuffer = FALSE; PUCHAR ReadBuffer = Buffer; - DPRINT("NtfsReadDisk(%p, %I64x, %u, %u, %p, %d)\n", DeviceObject, StartingOffset, Length, SectorSize, Buffer, Override); + DPRINT("NtfsReadDisk(%p, %I64x, %lu, %lu, %p, %d)\n", DeviceObject, StartingOffset, Length, SectorSize, Buffer, Override); KeInitializeEvent(&Event, NotificationEvent, @@ -176,7 +176,7 @@ BOOLEAN AllocatedBuffer = FALSE; PUCHAR TempBuffer = NULL; - DPRINT("NtfsWriteDisk(%p, %I64x, %u, %u, %p)\n", DeviceObject, StartingOffset, Length, SectorSize, Buffer); + DPRINT("NtfsWriteDisk(%p, %I64x, %lu, %lu, %p)\n", DeviceObject, StartingOffset, Length, SectorSize, Buffer); if (Length == 0) return STATUS_SUCCESS; Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/mft.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyst…
============================================================================== --- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/mft.c [iso-8859-1] (original) +++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/mft.c [iso-8859-1] Mon Jun 26 05:17:08 2017 @@ -119,7 +119,7 @@ FIND_ATTR_CONTXT Context; PNTFS_ATTR_RECORD Attribute; - DPRINT("FindAttribute(%p, %p, 0x%x, %S, %u, %p)\n", Vcb, MftRecord, Type, Name, NameLength, AttrCtx); + DPRINT("FindAttribute(%p, %p, 0x%x, %S, %lu, %p, %p)\n", Vcb, MftRecord, Type, Name, NameLength, AttrCtx, Offset); Found = FALSE; Status = FindFirstAttribute(&Context, Vcb, MftRecord, FALSE, &Attribute); @@ -395,6 +395,14 @@ PLARGE_INTEGER DataSize) { NTSTATUS Status = STATUS_SUCCESS; + + DPRINT1("SetAttributeDataLenth(%p, %p, %p, %lu, %p, %I64u)\n", + FileObject, + Fcb, + AttrContext, + AttrOffset, + FileRecord, + DataSize->QuadPart); // are we truncating the file? if (DataSize->QuadPart < AttributeDataLength(&AttrContext->Record)) @@ -1336,7 +1344,7 @@ BytesRead = ReadAttribute(Vcb, Vcb->MFTContext, index * Vcb->NtfsInfo.BytesPerFileRecord, (PCHAR)file, Vcb->NtfsInfo.BytesPerFileRecord); if (BytesRead != Vcb->NtfsInfo.BytesPerFileRecord) { - DPRINT1("ReadFileRecord failed: %I64u read, %u expected\n", BytesRead, Vcb->NtfsInfo.BytesPerFileRecord); + DPRINT1("ReadFileRecord failed: %I64u read, %lu expected\n", BytesRead, Vcb->NtfsInfo.BytesPerFileRecord); return STATUS_PARTIAL_COPY; } @@ -1370,11 +1378,11 @@ NTSTATUS Status; ULONG CurrentEntry = 0; - DPRINT("UpdateFileNameRecord(%p, %I64d, %wZ, %u, %I64u, %I64u, %s)\n", + DPRINT("UpdateFileNameRecord(%p, %I64d, %wZ, %s, %I64u, %I64u, %s)\n", Vcb, ParentMFTIndex, FileName, - DirSearch, + DirSearch ? "TRUE" : "FALSE", NewDataSize, NewAllocationSize, CaseSensitive ? "TRUE" : "FALSE"); @@ -1466,7 +1474,20 @@ ULONGLONG IndexAllocationSize; PINDEX_BUFFER IndexBuffer; - DPRINT("UpdateIndexEntrySize(%p, %p, %p, %u, %p, %p, %wZ, %u, %u, %u, %I64u, %I64u)\n", Vcb, MftRecord, IndexRecord, IndexBlockSize, FirstEntry, LastEntry, FileName, *StartEntry, *CurrentEntry, DirSearch, NewDataSize, NewAllocatedSize); + DPRINT("UpdateIndexEntrySize(%p, %p, %p, %lu, %p, %p, %wZ, %lu, %lu, %s, %I64u, %I64u, %s)\n", + Vcb, + MftRecord, + IndexRecord, + IndexBlockSize, + FirstEntry, + LastEntry, + FileName, + *StartEntry, + *CurrentEntry, + DirSearch ? "TRUE" : "FALSE", + NewDataSize, + NewAllocatedSize, + CaseSensitive ? "TRUE" : "FALSE"); // find the index entry responsible for the file we're trying to update IndexEntry = FirstEntry; @@ -1933,7 +1954,7 @@ ULONGLONG IndexAllocationSize; PINDEX_BUFFER IndexBuffer; - DPRINT("BrowseIndexEntries(%p, %p, %p, %u, %p, %p, %wZ, %u, %u, %s, %s, %p)\n", + DPRINT("BrowseIndexEntries(%p, %p, %p, %lu, %p, %p, %wZ, %lu, %lu, %s, %s, %p)\n", Vcb, MftRecord, IndexRecord, @@ -1981,7 +2002,7 @@ Status = FindAttribute(Vcb, MftRecord, AttributeIndexAllocation, L"$I30", 4, &IndexAllocationCtx, NULL); if (!NT_SUCCESS(Status)) { - DPRINT("Corrupted filesystem!\n"); + DPRINT1("Corrupted filesystem!\n"); return Status; } @@ -2031,8 +2052,8 @@ PUNICODE_STRING FileName, PULONG FirstEntry, BOOLEAN DirSearch, - ULONGLONG *OutMFTIndex, - BOOLEAN CaseSensitive) + BOOLEAN CaseSensitive, + ULONGLONG *OutMFTIndex) { PFILE_RECORD_HEADER MftRecord; PNTFS_ATTR_CONTEXT IndexRootCtx; @@ -2042,7 +2063,14 @@ NTSTATUS Status; ULONG CurrentEntry = 0; - DPRINT("NtfsFindMftRecord(%p, %I64d, %wZ, %u, %u, %p)\n", Vcb, MFTIndex, FileName, *FirstEntry, DirSearch, OutMFTIndex); + DPRINT("NtfsFindMftRecord(%p, %I64d, %wZ, %lu, %s, %s, %p)\n", + Vcb, + MFTIndex, + FileName, + *FirstEntry, + DirSearch ? "TRUE" : "FALSE", + CaseSensitive ? "TRUE" : "FALSE", + OutMFTIndex); MftRecord = ExAllocatePoolWithTag(NonPagedPool, Vcb->NtfsInfo.BytesPerFileRecord, @@ -2129,7 +2157,7 @@ { DPRINT("Current: %wZ\n", &Current); - Status = NtfsFindMftRecord(Vcb, CurrentMFTIndex, &Current, &FirstEntry, FALSE, &CurrentMFTIndex, CaseSensitive); + Status = NtfsFindMftRecord(Vcb, CurrentMFTIndex, &Current, &FirstEntry, FALSE, CaseSensitive, &CurrentMFTIndex); if (!NT_SUCCESS(Status)) { return Status; @@ -2222,7 +2250,7 @@ { NTSTATUS Status; - DPRINT("NtfsFindFileAt(%p, %wZ, %u, %p, %p, %I64x, %s)\n", + DPRINT("NtfsFindFileAt(%p, %wZ, %lu, %p, %p, %I64x, %s)\n", Vcb, SearchPattern, *FirstEntry, @@ -2231,7 +2259,7 @@ CurrentMFTIndex, (CaseSensitive ? "TRUE" : "FALSE")); - Status = NtfsFindMftRecord(Vcb, CurrentMFTIndex, SearchPattern, FirstEntry, TRUE, &CurrentMFTIndex, CaseSensitive); + Status = NtfsFindMftRecord(Vcb, CurrentMFTIndex, SearchPattern, FirstEntry, TRUE, CaseSensitive, &CurrentMFTIndex); if (!NT_SUCCESS(Status)) { DPRINT("NtfsFindFileAt: NtfsFindMftRecord() failed with status 0x%08lx\n", Status); Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/ntfs.h URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyst…
============================================================================== --- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/ntfs.h [iso-8859-1] (original) +++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/ntfs.h [iso-8859-1] Mon Jun 26 05:17:08 2017 @@ -1003,8 +1003,8 @@ PUNICODE_STRING FileName, PULONG FirstEntry, BOOLEAN DirSearch, - ULONGLONG *OutMFTIndex, - BOOLEAN CaseSensitive); + BOOLEAN CaseSensitive, + ULONGLONG *OutMFTIndex); /* misc.c */ Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/rw.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyst…
============================================================================== --- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/rw.c [iso-8859-1] (original) +++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/rw.c [iso-8859-1] Mon Jun 26 05:17:08 2017 @@ -60,7 +60,7 @@ PCHAR ReadBuffer = (PCHAR)Buffer; ULONGLONG StreamSize; - DPRINT1("NtfsReadFile(%p, %p, %p, %u, %u, %x, %p)\n", DeviceExt, FileObject, Buffer, Length, ReadOffset, IrpFlags, LengthRead); + DPRINT1("NtfsReadFile(%p, %p, %p, %lu, %lu, %lx, %p)\n", DeviceExt, FileObject, Buffer, Length, ReadOffset, IrpFlags, LengthRead); *LengthRead = 0; @@ -317,7 +317,7 @@ ULONG AttributeOffset; ULONGLONG StreamSize; - DPRINT("NtfsWriteFile(%p, %p, %p, %u, %u, %x, %s, %p)\n", + DPRINT("NtfsWriteFile(%p, %p, %p, %lu, %lu, %x, %s, %p)\n", DeviceExt, FileObject, Buffer,
7 years, 6 months
1
0
0
0
[ssawant] 75198: [QCKLNCH] -Added CWindowImpl for proper subclassing. -Now buttons are alive \0/. -Code Cleanup.
by ssawant@svn.reactos.org
Author: ssawant Date: Sun Jun 25 20:20:27 2017 New Revision: 75198 URL:
http://svn.reactos.org/svn/reactos?rev=75198&view=rev
Log: [QCKLNCH] -Added CWindowImpl for proper subclassing. -Now buttons are alive \0/. -Code Cleanup. Modified: branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CISFBand.cpp branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CISFBand.h branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CQuickLaunchBand.cpp Modified: branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CISFBand.cpp URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/shellext/reactos/dll/…
============================================================================== --- branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CISFBand.cpp [iso-8859-1] (original) +++ branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CISFBand.cpp [iso-8859-1] Sun Jun 25 20:20:27 2017 @@ -15,38 +15,41 @@ WINE_DEFAULT_DEBUG_CHANNEL(qcklnch); -//Misc Methods: -//Subclassing Button - -LRESULT CALLBACK MyWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) +//***************************************************************************************** +// *** CISFBand *** + +CISFBand::CISFBand() : m_hWndTb(NULL), m_BandID(0), m_pidl(NULL) {} + +CISFBand::~CISFBand() {} + +// *** CWindowImpl *** +//Subclassing + +LRESULT CISFBand::OnLButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { - switch (uMsg) - { - case WM_COMMAND: - { - MessageBox(0, L"Button Clicked!!", L"Testing", MB_OK | MB_ICONINFORMATION); - } - } - return DefSubclassProc(hWnd, uMsg, wParam, lParam); + TBBUTTON tb; + POINT pt; + DWORD pos = GetMessagePos(); + pt.x = GET_X_LPARAM(pos); + pt.y = GET_Y_LPARAM(pos); + ScreenToClient(&pt); + + int index = SendMessage(m_hWndTb, TB_HITTEST, 0, (LPARAM)&pt); + bool chk = SendMessage(m_hWndTb, TB_GETBUTTON, abs(index), (LPARAM)&tb); + if(chk) SHInvokeDefaultCommand(m_hWndTb, m_pISF, (LPITEMIDLIST)tb.dwData); + + return 0; } -//***************************************************************************************** -//CISFBand - -CISFBand::CISFBand() : m_hWnd(NULL), m_BandID(0) {} - -CISFBand::~CISFBand() {} - //ToolbarTest - HWND CISFBand::CreateSimpleToolbar(HWND hWndParent, HINSTANCE hInst) { // Declare and initialize local constants. const DWORD buttonStyles = BTNS_AUTOSIZE; // Create the toolbar. - HWND hWndToolbar = CreateWindowEx(0 , TOOLBARCLASSNAME, NULL, - WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT | TBSTYLE_LIST | CCS_NORESIZE, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, + HWND hWndToolbar = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, + WS_CHILD | TBSTYLE_FLAT | TBSTYLE_LIST | CCS_NORESIZE, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, hWndParent, NULL, hInst, NULL); if (hWndToolbar == NULL) return NULL; @@ -54,8 +57,7 @@ // Set the image list. HIMAGELIST* piml; HRESULT hr1 = SHGetImageList(SHIL_SMALL, IID_IImageList, (void**)&piml); - SendMessage(hWndToolbar, TB_SETIMAGELIST, 0, (LPARAM)piml); - //SendMessage(hWndToolbar, TB_LOADIMAGES, (WPARAM)IDB_STD_SMALL_COLOR, (LPARAM)HINST_COMMCTRL); + SendMessage(hWndToolbar, TB_SETIMAGELIST, 0, (LPARAM)piml); //Enumerate objects CComPtr<IEnumIDList> pedl; @@ -66,16 +68,14 @@ if (SUCCEEDED(hr1) && SUCCEEDED(hr2)) { ULONG count = 0; - for (int i=0; pedl->Next(MAX_PATH, &pidl, &count) != S_FALSE; i++) + for (int i=0; pedl->Next(MAX_PATH, &pidl, 0) != S_FALSE; i++, count++) { WCHAR sz[MAX_PATH]; int index = SHMapPIDLToSystemImageListIndex(m_pISF, pidl, NULL); m_pISF->GetDisplayNameOf(pidl, SHGDN_NORMAL, &stret); - StrRetToBuf(&stret, pidl, sz, sizeof(sz)); - //MessageBox(0, sz, L"Namespace Object Found!", MB_OK | MB_ICONINFORMATION); - - TBBUTTON tb = { MAKELONG(index, 0), i, TBSTATE_ENABLED, buttonStyles,{ 0 }, 0, (INT_PTR)sz }; - //SendMessage(hWndToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0); + StrRetToBuf(&stret, pidl, sz, sizeof(sz)); + + TBBUTTON tb = { MAKELONG(index, 0), i, TBSTATE_ENABLED, buttonStyles,{ 0 }, (DWORD_PTR)pidl, (INT_PTR)sz }; SendMessage(hWndToolbar, TB_INSERTBUTTONW, 0, (LPARAM)&tb); } } @@ -83,7 +83,7 @@ // Resize the toolbar, and then show it. SendMessage(hWndToolbar, TB_AUTOSIZE, 0, 0); - ShowWindow(hWndToolbar, TRUE); + ::ShowWindow(hWndToolbar, TRUE); CoTaskMemFree((void*)pidl); return hWndToolbar; @@ -91,11 +91,9 @@ /*****************************************************************************/ -//IObjectWithSite +// *** IObjectWithSite *** HRESULT STDMETHODCALLTYPE CISFBand::SetSite(IUnknown *pUnkSite) { - //MessageBox(0, L"CISFBand::SetSite called!", L"Testing", MB_OK | MB_ICONINFORMATION); - HRESULT hRet; HWND hwndParent; @@ -108,12 +106,9 @@ return hRet; } m_Site = pUnkSite; - - //m_hWnd = CreateWindowEx(0, L"BUTTON", L">>", WS_CHILD, CW_USEDEFAULT, CW_USEDEFAULT, 50, 50, hwndParent, 0, m_hInstance, 0); - //SetWindowSubclass(hwndParent, MyWndProc, 0, 0); //when button is clicked, parent receives WM_COMMAND, and thus subclassed to show a test message box - m_hWnd = CreateSimpleToolbar(hwndParent, m_hInstance); - SetWindowSubclass(hwndParent, MyWndProc, 0, 0); + m_hWndTb = CreateSimpleToolbar(hwndParent, m_hInstance); + SubclassWindow(m_hWndTb); return S_OK; } @@ -121,8 +116,7 @@ HRESULT STDMETHODCALLTYPE CISFBand::GetSite( IN REFIID riid, OUT VOID **ppvSite) - { - //MessageBox(0, L"GetSite called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); + { TRACE("CISFBand::GetSite(0x%p,0x%p)\n", riid, ppvSite); HRESULT hr; @@ -137,16 +131,14 @@ } /*****************************************************************************/ -//IDeskBand +// *** IDeskBand *** HRESULT STDMETHODCALLTYPE CISFBand::GetWindow(OUT HWND *phwnd) { - //MessageBox(0, L"GetWindow called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); - - if (!m_hWnd) + if (!m_hWndTb) return E_FAIL; if (!phwnd) return E_INVALIDARG; - *phwnd = m_hWnd; + *phwnd = m_hWndTb; return S_OK; } @@ -154,21 +146,16 @@ HRESULT STDMETHODCALLTYPE CISFBand::ContextSensitiveHelp( IN BOOL fEnterMode) { - /* FIXME: Implement */ - - //MessageBox(0, L"ContextSensitiveHelp called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); - + /* FIXME: Implement */ return E_NOTIMPL; } HRESULT STDMETHODCALLTYPE CISFBand::ShowDW( IN BOOL bShow) - { - //MessageBox(0, L"ShowDW called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); - - if (m_hWnd) - { - ShowWindow(m_hWnd, bShow ? SW_SHOW : SW_HIDE); + { + if (m_hWndTb) + { + ::ShowWindow(m_hWndTb, bShow ? SW_SHOW : SW_HIDE); } return S_OK; @@ -176,14 +163,12 @@ HRESULT STDMETHODCALLTYPE CISFBand::CloseDW( IN DWORD dwReserved) - { - //MessageBox(0, L"CloseDW called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); - - if (m_hWnd) - { - ShowWindow(m_hWnd, SW_HIDE); - DestroyWindow(m_hWnd); - m_hWnd = NULL; + { + if (m_hWndTb) + { + ::ShowWindow(m_hWndTb, SW_HIDE); + ::DestroyWindow(m_hWndTb); + m_hWndTb = NULL; } return S_OK; @@ -196,8 +181,6 @@ { /* No need to implement this method */ - //MessageBox(0, L"ResizeBorderDW called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); - return E_NOTIMPL; } @@ -205,12 +188,10 @@ IN DWORD dwBandID, IN DWORD dwViewMode, IN OUT DESKBANDINFO *pdbi) - { - //MessageBox(0, L"GetBandInfo called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); - - TRACE("CTaskBand::GetBandInfo(0x%x,0x%x,0x%p) hWnd=0x%p\n", dwBandID, dwViewMode, pdbi, m_hWnd); + { + TRACE("CTaskBand::GetBandInfo(0x%x,0x%x,0x%p) hWnd=0x%p\n", dwBandID, dwViewMode, pdbi, m_hWndTb); - if (m_hWnd && pdbi) + if (m_hWndTb && pdbi) { m_BandID = dwBandID; @@ -220,19 +201,19 @@ POINTL maxSize; POINTL itemSize; - ::GetWindowRect(m_hWnd, &actualRect); + ::GetWindowRect(m_hWndTb, &actualRect); actualSize.x = actualRect.right - actualRect.left; actualSize.y = actualRect.bottom - actualRect.top; // Obtain the ideal size, to be used as min and max - SendMessageW(m_hWnd, TB_AUTOSIZE, 0, 0); - SendMessageW(m_hWnd, TB_GETMAXSIZE, 0, reinterpret_cast<LPARAM>(&maxSize)); + SendMessageW(m_hWndTb, TB_AUTOSIZE, 0, 0); + SendMessageW(m_hWndTb, TB_GETMAXSIZE, 0, reinterpret_cast<LPARAM>(&maxSize)); idealSize = maxSize; - SendMessageW(m_hWnd, TB_GETIDEALSIZE, FALSE, reinterpret_cast<LPARAM>(&idealSize)); + SendMessageW(m_hWndTb, TB_GETIDEALSIZE, FALSE, reinterpret_cast<LPARAM>(&idealSize)); // Obtain the button size, to be used as the integral size - DWORD size = SendMessageW(m_hWnd, TB_GETBUTTONSIZE, 0, 0); + DWORD size = SendMessageW(m_hWndTb, TB_GETBUTTONSIZE, 0, 0); itemSize.x = GET_X_LPARAM(size); itemSize.y = GET_Y_LPARAM(size); @@ -267,14 +248,12 @@ } /*****************************************************************************/ - //IDeskBar + // *** IDeskBar *** HRESULT STDMETHODCALLTYPE CISFBand::SetClient( IN IUnknown *punkClient) { TRACE("IDeskBar::SetClient(0x%p)\n", punkClient); - //MessageBox(0, L"SetClient called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); - return E_NOTIMPL; } @@ -283,8 +262,6 @@ { TRACE("IDeskBar::GetClient(0x%p)\n", ppunkClient); - //MessageBox(0, L"GetClient called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); - return E_NOTIMPL; } @@ -293,18 +270,14 @@ { TRACE("IDeskBar::OnPosRectChangeDB(0x%p=(%d,%d,%d,%d))\n", prc, prc->left, prc->top, prc->right, prc->bottom); - //MessageBox(0, L"OnPosRectChangeDB called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); - - return S_OK; - } - -/*****************************************************************************/ -//IPersistStream + return S_OK; + } + +/*****************************************************************************/ +// *** IPersistStream *** HRESULT STDMETHODCALLTYPE CISFBand::GetClassID( OUT CLSID *pClassID) - { - //MessageBox(0, L"GetClassID called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); - + { TRACE("CISFBand::GetClassID(0x%p)\n", pClassID); /* We're going to return the (internal!) CLSID of the quick launch band */ *pClassID = CLSID_QuickLaunchBand; @@ -316,8 +289,6 @@ { /* The object hasn't changed since the last save! */ - //MessageBox(0, L"IsDirty called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); - return S_FALSE; } @@ -327,8 +298,6 @@ TRACE("CISFBand::Load called\n"); /* Nothing to do */ - //MessageBox(0, L"Load called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); - return S_OK; } @@ -338,25 +307,19 @@ { /* Nothing to do */ - //MessageBox(0, L"Save called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); - return S_OK; } HRESULT STDMETHODCALLTYPE CISFBand::GetSizeMax( OUT ULARGE_INTEGER *pcbSize) { - TRACE("CISFBand::GetSizeMax called\n"); - //pcbSize->QuadPart = 0; - - //MessageBox(0, L"GetSizeMax called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); - - return S_OK; - } - - -/*****************************************************************************/ -//IWinEventHandler + TRACE("CISFBand::GetSizeMax called\n"); + + return S_OK; + } + +/*****************************************************************************/ +// *** IWinEventHandler *** HRESULT STDMETHODCALLTYPE CISFBand::ProcessMessage( IN HWND hWnd, IN UINT uMsg, @@ -366,17 +329,14 @@ { TRACE("CISFBand: IWinEventHandler::ProcessMessage(0x%p, 0x%x, 0x%p, 0x%p, 0x%p)\n", hWnd, uMsg, wParam, lParam, plrResult); - //MessageBox(0, L"ProcessMessage called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); return E_NOTIMPL; } HRESULT STDMETHODCALLTYPE CISFBand::ContainsWindow( IN HWND hWnd) - { - //MessageBox(0, L"ContainsWindow called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); - - if (hWnd == m_hWnd || - IsChild(m_hWnd, hWnd)) + { + if (hWnd == m_hWndTb || + ::IsChild(m_hWndTb, hWnd)) { TRACE("CISFBand::ContainsWindow(0x%p) returns S_OK\n", hWnd); return S_OK; @@ -386,55 +346,28 @@ } HRESULT STDMETHODCALLTYPE CISFBand::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult) - { - //MessageBox(0, L"OnWinEvent called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); + { UNIMPLEMENTED; return E_NOTIMPL; } HRESULT STDMETHODCALLTYPE CISFBand::IsWindowOwner(HWND hWnd) - { - //MessageBox(0, L"IsWindowOwner called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); - return (hWnd == m_hWnd) ? S_OK : S_FALSE; - } - + { + return (hWnd == m_hWndTb) ? S_OK : S_FALSE; + } + /*****************************************************************************/ // *** IOleCommandTarget methods *** HRESULT STDMETHODCALLTYPE CISFBand::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText) - { - //MessageBox(0, L"QueryStatus called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); + { UNIMPLEMENTED; return E_NOTIMPL; } HRESULT STDMETHODCALLTYPE CISFBand::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) - { - /* if (*pguidCmdGroup == CGID_IDeskBand) - { - switch (m_BandID) - { - case DBID_BANDINFOCHANGED: - case DBID_MAXIMIZEBAND: - { - pvaIn = (VARIANT*)m_BandID; - return S_OK; - } - case DBID_SHOWONLY: - { - pvaIn = (VARIANT*)VT_UNKNOWN; - return S_OK; - } - case DBID_PUSHCHEVRON: - { - nCmdexecopt = m_BandID; - pvaIn = (VARIANT*)VT_I4; - return S_OK; - } - default: return S_OK; - } - }*/ + { if (IsEqualIID(*pguidCmdGroup, IID_IBandSite)) { return S_OK; @@ -443,15 +376,15 @@ if (IsEqualIID(*pguidCmdGroup, IID_IDeskBand)) { return S_OK; - } + } - //MessageBox(0, L"Exec called!", L"Test Caption", MB_OK | MB_ICONINFORMATION); UNIMPLEMENTED; return E_NOTIMPL; } -//IShellFolderBand +/*****************************************************************************/ +// *** IShellFolderBand *** HRESULT STDMETHODCALLTYPE CISFBand::GetBandInfoSFB(PBANDINFOSFB pbi) { return E_NOTIMPL; @@ -481,6 +414,7 @@ return E_NOTIMPL; } +/*****************************************************************************/ //C Constructor extern "C" HRESULT WINAPI CISFBand_CreateInstance(REFIID riid, void** ppv) Modified: branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CISFBand.h URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/shellext/reactos/dll/…
============================================================================== --- branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CISFBand.h [iso-8859-1] (original) +++ branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CISFBand.h [iso-8859-1] Sun Jun 25 20:20:27 2017 @@ -9,8 +9,9 @@ //COM class for cisfband class CISFBand : + public CWindowImpl<CISFBand>, public CComCoClass<CISFBand>, - public CComObjectRootEx<CComMultiThreadModelNoCS>, + public CComObjectRootEx<CComMultiThreadModelNoCS>, public IObjectWithSite, public IDeskBand, public IDeskBar, @@ -21,9 +22,9 @@ { HINSTANCE m_hInstance; CComPtr<IUnknown> m_Site; - CComPtr<IShellFolder> m_pISF; + CComPtr<IShellFolder> m_pISF; PCIDLIST_ABSOLUTE m_pidl; - HWND m_hWnd; + HWND m_hWndTb; DWORD m_BandID; public: @@ -33,7 +34,8 @@ //Personal Methods HWND CreateSimpleToolbar(HWND hWndParent, HINSTANCE hInst); - + LRESULT OnLButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + //IObjectWithSite virtual HRESULT STDMETHODCALLTYPE GetSite( @@ -166,9 +168,12 @@ virtual HRESULT STDMETHODCALLTYPE SetBandInfoSFB( PBANDINFOSFB pbi ); + +//***************************************************************************************************** + BEGIN_MSG_MAP(CStartButton) + MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp) + END_MSG_MAP() -//***************************************************************************************************** - DECLARE_NOT_AGGREGATABLE(CISFBand) DECLARE_PROTECT_FINAL_CONSTRUCT() Modified: branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CQuickLaunchBand.cpp URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/shellext/reactos/dll/…
============================================================================== --- branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CQuickLaunchBand.cpp [iso-8859-1] (original) +++ branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CQuickLaunchBand.cpp [iso-8859-1] Sun Jun 25 20:20:27 2017 @@ -72,32 +72,23 @@ HRESULT CQuickLaunchBand::FinalConstruct() { - //MessageBox(0, L"CQuickLaunchBand::FinalConstruct Begin!", L"Testing", MB_OK | MB_ICONINFORMATION); - HRESULT hr = CISFBand_CreateInstance(IID_IUnknown, (void**) &m_punkISFB); if (SUCCEEDED(hr)) - { - //MessageBox(0, L"CreateInstance success!", L"Testing", MB_OK | MB_ICONINFORMATION); - + { CComPtr<IShellFolderBand> pISFB; hr = m_punkISFB->QueryInterface(IID_IShellFolderBand, (void**) &pISFB); if (SUCCEEDED(hr)) { - //MessageBox(0, L"IID_ISFBand query success!", L"Testing", MB_OK | MB_ICONINFORMATION); - CComPtr<IShellFolder> pISF; hr = SHGetDesktopFolder(&pISF); if (SUCCEEDED(hr)) - { - //MessageBox(0, L"pisf success!", L"Testing", MB_OK | MB_ICONINFORMATION); + { LPITEMIDLIST pidl = PidlBrowse(m_hWndBro, CSIDL_DESKTOP); if (pidl == NULL) return E_FAIL; pISFB->InitializeSFB(pISF, pidl); } } - } - - // MessageBox(0, L"CQuickLaunchBand::FinalConstruct End!", L"Testing", MB_OK | MB_ICONINFORMATION); + } return hr; }
7 years, 6 months
1
0
0
0
[ekohl] 75197: [IDL] Add the Netlogon service interface definition.
by ekohl@svn.reactos.org
Author: ekohl Date: Sun Jun 25 13:14:06 2017 New Revision: 75197 URL:
http://svn.reactos.org/svn/reactos?rev=75197&view=rev
Log: [IDL] Add the Netlogon service interface definition. Added: trunk/reactos/sdk/include/reactos/idl/netlogon.acf (with props) trunk/reactos/sdk/include/reactos/idl/netlogon.idl (with props) Added: trunk/reactos/sdk/include/reactos/idl/netlogon.acf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/reactos/idl/ne…
============================================================================== --- trunk/reactos/sdk/include/reactos/idl/netlogon.acf (added) +++ trunk/reactos/sdk/include/reactos/idl/netlogon.acf [iso-8859-1] Sun Jun 25 13:14:06 2017 @@ -0,0 +1,6 @@ +[ + explicit_handle +] +interface netlogon +{ +} Propchange: trunk/reactos/sdk/include/reactos/idl/netlogon.acf ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/sdk/include/reactos/idl/netlogon.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/reactos/idl/ne…
============================================================================== --- trunk/reactos/sdk/include/reactos/idl/netlogon.idl (added) +++ trunk/reactos/sdk/include/reactos/idl/netlogon.idl [iso-8859-1] Sun Jun 25 13:14:06 2017 @@ -0,0 +1,1500 @@ +/* + * Netlogon Service interface definition + */ + +#include <ms-dtyp.idl> + +cpp_quote("#if 0") +typedef ULONG NTSTATUS; + +typedef struct _STRING +{ + USHORT Length; + USHORT MaximumLength; + [size_is(MaximumLength), length_is(Length)] CHAR *Buffer; +} STRING, *PSTRING; +cpp_quote("#endif") + +typedef struct _OLD_LARGE_INTEGER +{ + ULONG LowPart; + LONG HighPart; +} OLD_LARGE_INTEGER, *POLD_LARGE_INTEGER; + +typedef struct _CYPHER_BLOCK +{ + CHAR data[8]; +} CYPHER_BLOCK, *PCYPHER_BLOCK; + +typedef struct _NT_OWF_PASSWORD +{ + CYPHER_BLOCK data[2]; +} NT_OWF_PASSWORD, *PNT_OWF_PASSWORD, ENCRYPTED_NT_OWF_PASSWORD, *PENCRYPTED_NT_OWF_PASSWORD; + +typedef struct _LM_OWF_PASSWORD +{ + CYPHER_BLOCK data[2]; +} LM_OWF_PASSWORD, *PLM_OWF_PASSWORD, ENCRYPTED_LM_OWF_PASSWORD, *PENCRYPTED_LM_OWF_PASSWORD; + +typedef [handle] wchar_t *LOGONSRV_HANDLE; + +typedef struct _NLPR_SID_INFORMATION +{ + PRPC_SID SidPointer; +} NLPR_SID_INFORMATION, *PNLPR_SID_INFORMATION; + +typedef struct _NLPR_SID_ARRAY +{ + ULONG Count; + [size_is(Count)] PNLPR_SID_INFORMATION Sids; +} NLPR_SID_ARRAY, *PNLPR_SID_ARRAY; + +typedef struct _NLPR_CR_CIPHER_VALUE +{ + ULONG Length; + ULONG MaximumLength; + [size_is(MaximumLength), length_is(Length)] UCHAR *Buffer; +} NLPR_CR_CIPHER_VALUE, *PNLPR_CR_CIPHER_VALUE; + +typedef struct _NLPR_LOGON_HOURS +{ + USHORT UnitsPerWeek; + [size_is(1260), length_is((UnitsPerWeek + 7) / 8)] UCHAR *LogonHours; +} NLPR_LOGON_HOURS, *PNLPR_LOGON_HOURS; + +typedef struct _NLPR_USER_PRIVATE_INFO +{ + UCHAR SensitiveData; + ULONG DataLength; + [size_is(DataLength)] UCHAR *Data; +} NLPR_USER_PRIVATE_INFO, *PNLPR_USER_PRIVATE_INFO; + +typedef struct _NLPR_MODIFIED_COUNT +{ + OLD_LARGE_INTEGER ModifiedCount; +} NLPR_MODIFIED_COUNT, *PNLPR_MODIFIED_COUNT; + +typedef struct _NLPR_QUOTA_LIMITS +{ + ULONG PagedPoolLimit; + ULONG NonPagedPoolLimit; + ULONG MinimumWorkingSetSize; + ULONG MaximumWorkingSetSize; + ULONG PagefileLimit; + OLD_LARGE_INTEGER Reserved; +} NLPR_QUOTA_LIMITS, *PNLPR_QUOTA_LIMITS; + +typedef struct _NETLOGON_DELTA_USER +{ + RPC_UNICODE_STRING UserName; + RPC_UNICODE_STRING FullName; + ULONG UserId; + ULONG PrimaryGroupId; + RPC_UNICODE_STRING HomeDirectory; + RPC_UNICODE_STRING HomeDirectoryDrive; + RPC_UNICODE_STRING ScriptPath; + RPC_UNICODE_STRING AdminComment; + RPC_UNICODE_STRING WorkStations; + OLD_LARGE_INTEGER LastLogon; + OLD_LARGE_INTEGER LastLogoff; + NLPR_LOGON_HOURS LogonHours; + USHORT BadPasswordCount; + USHORT LogonCount; + OLD_LARGE_INTEGER PasswordLastSet; + OLD_LARGE_INTEGER AccountExpires; + ULONG UserAccountControl; + ENCRYPTED_NT_OWF_PASSWORD EncryptedNtOwfPassword; + ENCRYPTED_LM_OWF_PASSWORD EncryptedLmOwfPassword; + UCHAR NtPasswordPresent; + UCHAR LmPasswordPresent; + UCHAR PasswordExpired; + RPC_UNICODE_STRING UserComment; + RPC_UNICODE_STRING Parameters; + USHORT CountryCode; + USHORT CodePage; + NLPR_USER_PRIVATE_INFO PrivateData; + SECURITY_INFORMATION SecurityInformation; + ULONG SecuritySize; + [size_is(SecuritySize)] UCHAR *SecurityDescriptor; + RPC_UNICODE_STRING ProfilePath; + RPC_UNICODE_STRING DummyString2; + RPC_UNICODE_STRING DummyString3; + RPC_UNICODE_STRING DummyString4; + ULONG DummyLong1; + ULONG DummyLong2; + ULONG DummyLong3; + ULONG DummyLong4; +} NETLOGON_DELTA_USER, *PNETLOGON_DELTA_USER; + +typedef struct _NETLOGON_DELTA_GROUP +{ + RPC_UNICODE_STRING Name; + ULONG RelativeId; + ULONG Attributes; + RPC_UNICODE_STRING AdminComment; + SECURITY_INFORMATION SecurityInformation; + ULONG SecuritySize; + [size_is(SecuritySize)] UCHAR *SecurityDescriptor; + RPC_UNICODE_STRING DummyString1; + RPC_UNICODE_STRING DummyString2; + RPC_UNICODE_STRING DummyString3; + RPC_UNICODE_STRING DummyString4; + ULONG DummyLong1; + ULONG DummyLong2; + ULONG DummyLong3; + ULONG DummyLong4; +} NETLOGON_DELTA_GROUP, *PNETLOGON_DELTA_GROUP; + +typedef struct _NETLOGON_DELTA_GROUP_MEMBER +{ + [size_is(MemberCount)] ULONG *Members; + [size_is(MemberCount)] ULONG *Attributes; + ULONG MemberCount; + ULONG DummyLong1; + ULONG DummyLong2; + ULONG DummyLong3; + ULONG DummyLong4; +} NETLOGON_DELTA_GROUP_MEMBER, *PNETLOGON_DELTA_GROUP_MEMBER; + +typedef struct _NETLOGON_DELTA_ALIAS +{ + RPC_UNICODE_STRING Name; + ULONG RelativeId; + SECURITY_INFORMATION SecurityInformation; + ULONG SecuritySize; + [size_is(SecuritySize)] UCHAR *SecurityDescriptor; + RPC_UNICODE_STRING Comment; + RPC_UNICODE_STRING DummyString2; + RPC_UNICODE_STRING DummyString3; + RPC_UNICODE_STRING DummyString4; + ULONG DummyLong1; + ULONG DummyLong2; + ULONG DummyLong3; + ULONG DummyLong4; +} NETLOGON_DELTA_ALIAS, *PNETLOGON_DELTA_ALIAS; + +typedef struct _NETLOGON_DELTA_ALIAS_MEMBER +{ + NLPR_SID_ARRAY Members; + ULONG DummyLong1; + ULONG DummyLong2; + ULONG DummyLong3; + ULONG DummyLong4; +} NETLOGON_DELTA_ALIAS_MEMBER, *PNETLOGON_DELTA_ALIAS_MEMBER; + +typedef struct _NETLOGON_DELTA_DOMAIN +{ + RPC_UNICODE_STRING DomainName; + RPC_UNICODE_STRING OemInformation; + OLD_LARGE_INTEGER ForceLogoff; + USHORT MinPasswordLength; + USHORT PasswordHistoryLength; + OLD_LARGE_INTEGER MaxPasswordAge; + OLD_LARGE_INTEGER MinPasswordAge; + OLD_LARGE_INTEGER DomainModifiedCount; + OLD_LARGE_INTEGER DomainCreationTime; + SECURITY_INFORMATION SecurityInformation; + ULONG SecuritySize; + [size_is(SecuritySize)] UCHAR *SecurityDescriptor; + RPC_UNICODE_STRING DomainLockoutInformation; + RPC_UNICODE_STRING DummyString2; + RPC_UNICODE_STRING DummyString3; + RPC_UNICODE_STRING DummyString4; + ULONG PasswordProperties; + ULONG DummyLong2; + ULONG DummyLong3; + ULONG DummyLong4; +} NETLOGON_DELTA_DOMAIN, *PNETLOGON_DELTA_DOMAIN; + +typedef struct _NETLOGON_DELTA_RENAME_GROUP +{ + RPC_UNICODE_STRING OldName; + RPC_UNICODE_STRING NewName; + RPC_UNICODE_STRING DummyString1; + RPC_UNICODE_STRING DummyString2; + RPC_UNICODE_STRING DummyString3; + RPC_UNICODE_STRING DummyString4; + ULONG DummyLong1; + ULONG DummyLong2; + ULONG DummyLong3; + ULONG DummyLong4; +} NETLOGON_RENAME_GROUP, *PNETLOGON_DELTA_RENAME_GROUP; + +typedef struct _NETLOGON_DELTA_RENAME_USER +{ + RPC_UNICODE_STRING OldName; + RPC_UNICODE_STRING NewName; + RPC_UNICODE_STRING DummyString1; + RPC_UNICODE_STRING DummyString2; + RPC_UNICODE_STRING DummyString3; + RPC_UNICODE_STRING DummyString4; + ULONG DummyLong1; + ULONG DummyLong2; + ULONG DummyLong3; + ULONG DummyLong4; +} NETLOGON_RENAME_USER, *PNETLOGON_DELTA_RENAME_USER; + +typedef struct _NETLOGON_DELTA_RENAME_ALIAS +{ + RPC_UNICODE_STRING OldName; + RPC_UNICODE_STRING NewName; + RPC_UNICODE_STRING DummyString1; + RPC_UNICODE_STRING DummyString2; + RPC_UNICODE_STRING DummyString3; + RPC_UNICODE_STRING DummyString4; + ULONG DummyLong1; + ULONG DummyLong2; + ULONG DummyLong3; + ULONG DummyLong4; +} NETLOGON_RENAME_ALIAS, *PNETLOGON_DELTA_RENAME_ALIAS; + +typedef struct _NETLOGON_DELTA_POLICY +{ + ULONG MaximumLogSize; + OLD_LARGE_INTEGER AuditRetentionPeriod; + UCHAR AuditingMode; + ULONG MaximumAuditEventCount; + [size_is(MaximumAuditEventCount + 1)] ULONG *EventAuditingOptions; + RPC_UNICODE_STRING PrimaryDomainName; + PRPC_SID PrimaryDomainSid; + NLPR_QUOTA_LIMITS QuotaLimits; + OLD_LARGE_INTEGER ModifiedId; + OLD_LARGE_INTEGER DatabaseCreationTime; + SECURITY_INFORMATION SecurityInformation; + ULONG SecuritySize; + [size_is(SecuritySize)] UCHAR *SecurityDescriptor; + RPC_UNICODE_STRING DummyString1; + RPC_UNICODE_STRING DummyString2; + RPC_UNICODE_STRING DummyString3; + RPC_UNICODE_STRING DummyString4; + ULONG DummyLong1; + ULONG DummyLong2; + ULONG DummyLong3; + ULONG DummyLong4; +} NETLOGON_DELTA_POLICY, *PNETLOGON_DELTA_POLICY; + +typedef struct _NETLOGON_DELTA_TRUSTED_DOMAINS +{ + RPC_UNICODE_STRING DomainName; + ULONG NumControllerEntries; + [size_is(NumControllerEntries)] PRPC_UNICODE_STRING ControllerNames; + SECURITY_INFORMATION SecurityInformation; + ULONG SecuritySize; + [size_is(SecuritySize)] UCHAR *SecurityDescriptor; + RPC_UNICODE_STRING DummyString1; + RPC_UNICODE_STRING DummyString2; + RPC_UNICODE_STRING DummyString3; + RPC_UNICODE_STRING DummyString4; + ULONG TrustedPosixOffset; + ULONG DummyLong2; + ULONG DummyLong3; + ULONG DummyLong4; +} NETLOGON_DELTA_TRUSTED_DOMAINS, *PNETLOGON_DELTA_TRUSTED_DOMAINS; + +typedef struct _NETLOGON_DELTA_ACCOUNTS +{ + ULONG PrivilegeEntries; + ULONG PrivilegeControl; + [size_is(PrivilegeEntries)] ULONG *PrivilegeAttributes; + [size_is(PrivilegeEntries)] PRPC_UNICODE_STRING PrivilegeNames; + NLPR_QUOTA_LIMITS QuotaLimits; + ULONG SystemAccessFlags; + SECURITY_INFORMATION SecurityInformation; + ULONG SecuritySize; + [size_is(SecuritySize)] UCHAR *SecurityDescriptor; + RPC_UNICODE_STRING DummyString1; + RPC_UNICODE_STRING DummyString2; + RPC_UNICODE_STRING DummyString3; + RPC_UNICODE_STRING DummyString4; + ULONG DummyLong1; + ULONG DummyLong2; + ULONG DummyLong3; + ULONG DummyLong4; +} NETLOGON_DELTA_ACCOUNTS, *PNETLOGON_DELTA_ACCOUNTS; + +typedef struct _NETLOGON_DELTA_SECRET +{ + NLPR_CR_CIPHER_VALUE CurrentValue; + OLD_LARGE_INTEGER CurrentValueSetTime; + NLPR_CR_CIPHER_VALUE OldValue; + OLD_LARGE_INTEGER OldValueSetTime; + SECURITY_INFORMATION SecurityInformation; + ULONG SecuritySize; + [size_is(SecuritySize)] UCHAR *SecurityDescriptor; + RPC_UNICODE_STRING DummyString1; + RPC_UNICODE_STRING DummyString2; + RPC_UNICODE_STRING DummyString3; + RPC_UNICODE_STRING DummyString4; + ULONG DummyLong1; + ULONG DummyLong2; + ULONG DummyLong3; + ULONG DummyLong4; +} NETLOGON_DELTA_SECRET, *PNETLOGON_DELTA_SECRET; + +typedef struct _NETLOGON_DELTA_DELETE_GROUP +{ + [string] wchar_t *AccountName; + RPC_UNICODE_STRING DummyString1; + RPC_UNICODE_STRING DummyString2; + RPC_UNICODE_STRING DummyString3; + RPC_UNICODE_STRING DummyString4; + ULONG DummyLong1; + ULONG DummyLong2; + ULONG DummyLong3; + ULONG DummyLong4; +} NETLOGON_DELTA_DELETE_GROUP, *PNETLOGON_DELTA_DELETE_GROUP; + +typedef struct _NETLOGON_DELTA_DELETE_USER +{ + [string] wchar_t *AccountName; + RPC_UNICODE_STRING DummyString1; + RPC_UNICODE_STRING DummyString2; + RPC_UNICODE_STRING DummyString3; + RPC_UNICODE_STRING DummyString4; + ULONG DummyLong1; + ULONG DummyLong2; + ULONG DummyLong3; + ULONG DummyLong4; +} NETLOGON_DELTA_DELETE_USER, *PNETLOGON_DELTA_DELETE_USER; + +typedef enum _NETLOGON_DELTA_TYPE +{ + AddOrChangeDomain = 1, + AddOrChangeGroup = 2, + DeleteGroup = 3, + RenameGroup = 4, + AddOrChangeUser = 5, + DeleteUser = 6, + RenameUser = 7, + ChangeGroupMembership = 8, + AddOrChangeAlias = 9, + DeleteAlias = 10, + RenameAlias = 11, + ChangeAliasMembership = 12, + AddOrChangeLsaPolicy = 13, + AddOrChangeLsaTDomain = 14, + DeleteLsaTDomain = 15, + AddOrChangeLsaAccount = 16, + DeleteLsaAccount = 17, + AddOrChangeLsaSecret = 18, + DeleteLsaSecret = 19, + DeleteGroupByName = 20, + DeleteUserByName = 21, + SerialNumberSkip = 22 +} NETLOGON_DELTA_TYPE; + +typedef [switch_type(NETLOGON_DELTA_TYPE)] union _NETLOGON_DELTA_UNION +{ + [case(AddOrChangeDomain)] PNETLOGON_DELTA_DOMAIN DeltaDomain; + [case(AddOrChangeGroup)] PNETLOGON_DELTA_GROUP DeltaGroup; + [case(RenameGroup)] PNETLOGON_DELTA_RENAME_GROUP DeltaRenameGroup; + [case(AddOrChangeUser)] PNETLOGON_DELTA_USER DeltaUser; + [case(RenameUser)] PNETLOGON_DELTA_RENAME_USER DeltaRenameUser; + [case(ChangeGroupMembership)] PNETLOGON_DELTA_GROUP_MEMBER DeltaGroupMember; + [case(AddOrChangeAlias)] PNETLOGON_DELTA_ALIAS DeltaAlias; + [case(RenameAlias)] PNETLOGON_DELTA_RENAME_ALIAS DeltaRenameAlias; + [case(ChangeAliasMembership)] PNETLOGON_DELTA_ALIAS_MEMBER DeltaAliasMember; + [case(AddOrChangeLsaPolicy)] PNETLOGON_DELTA_POLICY DeltaPolicy; + [case(AddOrChangeLsaTDomain)] PNETLOGON_DELTA_TRUSTED_DOMAINS DeltaTDomains; + [case(AddOrChangeLsaAccount)] PNETLOGON_DELTA_ACCOUNTS DeltaAccounts; + [case(AddOrChangeLsaSecret)] PNETLOGON_DELTA_SECRET DeltaSecret; + [case(DeleteGroupByName)] PNETLOGON_DELTA_DELETE_GROUP DeltaDeleteGroup; + [case(DeleteUserByName)] PNETLOGON_DELTA_DELETE_USER DeltaDeleteUser; + [case(SerialNumberSkip)] PNLPR_MODIFIED_COUNT DeltaSerialNumberSkip; + [default] ; +} NETLOGON_DELTA_UNION, *PNETLOGON_DELTA_UNION; + +typedef [switch_type(NETLOGON_DELTA_TYPE)] union _NETLOGON_DELTA_ID_UNION +{ + [case(AddOrChangeDomain, + AddOrChangeGroup, + DeleteGroup, + RenameGroup, + AddOrChangeUser, + DeleteUser, + RenameUser, + ChangeGroupMembership, + AddOrChangeAlias, + DeleteAlias, + RenameAlias, + ChangeAliasMembership, + DeleteGroupByName, + DeleteUserByName)] ULONG Rid; + [case(AddOrChangeLsaPolicy, + AddOrChangeLsaTDomain, + DeleteLsaTDomain, + AddOrChangeLsaAccount, + DeleteLsaAccount)] PRPC_SID Sid; + [case(AddOrChangeLsaSecret, + DeleteLsaSecret)] [string] wchar_t *Name; + [default] ; +} NETLOGON_DELTA_ID_UNION, *PNETLOGON_DELTA_ID_UNION; + +typedef struct _NETLOGON_DELTA_ENUM +{ + NETLOGON_DELTA_TYPE DeltaType; + [switch_is(DeltaType)] NETLOGON_DELTA_ID_UNION DeltaID; + [switch_is(DeltaType)] NETLOGON_DELTA_UNION DeltaUnion; +} NETLOGON_DELTA_ENUM, *PNETLOGON_DELTA_ENUM; + +typedef struct _NETLOGON_DELTA_ENUM_ARRAY +{ + DWORD CountReturned; + [size_is(CountReturned)] PNETLOGON_DELTA_ENUM Deltas; +} NETLOGON_DELTA_ENUM_ARRAY, *PNETLOGON_DELTA_ENUM_ARRAY; + +typedef struct _NETLOGON_LOGON_IDENTITY_INFO +{ + RPC_UNICODE_STRING LogonDomainName; + ULONG ParameterControl; + OLD_LARGE_INTEGER Reserved; + RPC_UNICODE_STRING UserName; + RPC_UNICODE_STRING Workstation; +} NETLOGON_LOGON_IDENTITY_INFO, *PNETLOGON_LOGON_IDENTITY_INFO; + +typedef struct _NETLOGON_INTERACTIVE_INFO +{ + NETLOGON_LOGON_IDENTITY_INFO Identity; + LM_OWF_PASSWORD LmOwfPassword; + NT_OWF_PASSWORD NtOwfPassword; +} NETLOGON_INTERACTIVE_INFO, *PNETLOGON_INTERACTIVE_INFO; + +typedef enum _NETLOGON_LOGON_INFO_CLASS +{ + NetlogonInteractiveInformation = 1, + NetlogonNetworkInformation = 2, + NetlogonServiceInformation = 3, + NetlogonGenericInformation = 4, + NetlogonInteractiveTransitiveInformation = 5, + NetlogonNetworkTransitiveInformation = 6, + NetlogonServiceTransitiveInformation = 7 +} NETLOGON_LOGON_INFO_CLASS; + +typedef struct _NETLOGON_SERVICE_INFO +{ + NETLOGON_LOGON_IDENTITY_INFO Identity; + LM_OWF_PASSWORD LmOwfPassword; + NT_OWF_PASSWORD NtOwfPassword; +} NETLOGON_SERVICE_INFO, *PNETLOGON_SERVICE_INFO; + +typedef struct +{ + CHAR data[8]; +} LM_CHALLENGE; + +typedef struct _NETLOGON_NETWORK_INFO +{ + NETLOGON_LOGON_IDENTITY_INFO Identity; + LM_CHALLENGE LmChallenge; + STRING NtChallengeResponse; + STRING LmChallengeResponse; +} NETLOGON_NETWORK_INFO, *PNETLOGON_NETWORK_INFO; + +typedef struct _NETLOGON_GENERIC_INFO +{ + NETLOGON_LOGON_IDENTITY_INFO Identity; + RPC_UNICODE_STRING PackageName; + ULONG DataLength; + [size_is(DataLength)] UCHAR *LogonData; +} NETLOGON_GENERIC_INFO, *PNETLOGON_GENERIC_INFO; + +typedef [switch_type(NETLOGON_LOGON_INFO_CLASS)] union _NETLOGON_LEVEL +{ + [case(NetlogonInteractiveInformation)] PNETLOGON_INTERACTIVE_INFO LogonInteractive; + [case(NetlogonInteractiveTransitiveInformation)] PNETLOGON_INTERACTIVE_INFO LogonInteractiveTransitive; + [case(NetlogonServiceInformation)] PNETLOGON_SERVICE_INFO LogonService; + [case(NetlogonServiceTransitiveInformation)] PNETLOGON_SERVICE_INFO LogonServiceTransitive; + [case(NetlogonNetworkInformation)] PNETLOGON_NETWORK_INFO LogonNetwork; + [case(NetlogonNetworkTransitiveInformation)] PNETLOGON_NETWORK_INFO LogonNetworkTransitive; + [case(NetlogonGenericInformation)] PNETLOGON_GENERIC_INFO LogonGeneric; + [default] ; +} NETLOGON_LEVEL, *PNETLOGON_LEVEL; + +typedef enum _NETLOGON_VALIDATION_INFO_CLASS +{ + NetlogonValidationUasInfo = 1, + NetlogonValidationSamInfo = 2, + NetlogonValidationSamInfo2 = 3, + NetlogonValidationGenericInfo = 4, + NetlogonValidationGenericInfo2 = 5, + NetlogonValidationSamInfo4 = 6 +} NETLOGON_VALIDATION_INFO_CLASS; + +cpp_quote("#ifndef _NTSAM_") +typedef struct _GROUP_MEMBERSHIP +{ + ULONG RelativeId; + ULONG Attributes; +} GROUP_MEMBERSHIP, *PGROUP_MEMBERSHIP; +cpp_quote("#endif") + +typedef struct _USER_SESSION_KEY +{ + CYPHER_BLOCK data[2]; +} USER_SESSION_KEY, *PUSER_SESSION_KEY; + +typedef struct _NETLOGON_SID_AND_ATTRIBUTES +{ + PRPC_SID Sid; + ULONG Attributes; +} NETLOGON_SID_AND_ATTRIBUTES, *PNETLOGON_SID_AND_ATTRIBUTES; + +typedef struct _NETLOGON_VALIDATION_SAM_INFO +{ + OLD_LARGE_INTEGER LogonTime; + OLD_LARGE_INTEGER LogoffTime; + OLD_LARGE_INTEGER KickOffTime; + OLD_LARGE_INTEGER PasswordLastSet; + OLD_LARGE_INTEGER PasswordCanChange; + OLD_LARGE_INTEGER PasswordMustChange; + RPC_UNICODE_STRING EffectiveName; + RPC_UNICODE_STRING FullName; + RPC_UNICODE_STRING LogonScript; + RPC_UNICODE_STRING ProfilePath; + RPC_UNICODE_STRING HomeDirectory; + RPC_UNICODE_STRING HomeDirectoryDrive; + USHORT LogonCount; + USHORT BadPasswordCount; + ULONG UserId; + ULONG PrimaryGroupId; + ULONG GroupCount; + [size_is(GroupCount)] PGROUP_MEMBERSHIP GroupIds; + ULONG UserFlags; + USER_SESSION_KEY UserSessionKey; + RPC_UNICODE_STRING LogonServer; + RPC_UNICODE_STRING LogonDomainName; + PRPC_SID LogonDomainId; + ULONG ExpansionRoom[10]; +} NETLOGON_VALIDATION_SAM_INFO, *PNETLOGON_VALIDATION_SAM_INFO; + +typedef struct _NETLOGON_VALIDATION_SAM_INFO2 +{ + OLD_LARGE_INTEGER LogonTime; + OLD_LARGE_INTEGER LogoffTime; + OLD_LARGE_INTEGER KickOffTime; + OLD_LARGE_INTEGER PasswordLastSet; + OLD_LARGE_INTEGER PasswordCanChange; + OLD_LARGE_INTEGER PasswordMustChange; + RPC_UNICODE_STRING EffectiveName; + RPC_UNICODE_STRING FullName; + RPC_UNICODE_STRING LogonScript; + RPC_UNICODE_STRING ProfilePath; + RPC_UNICODE_STRING HomeDirectory; + RPC_UNICODE_STRING HomeDirectoryDrive; + USHORT LogonCount; + USHORT BadPasswordCount; + ULONG UserId; + ULONG PrimaryGroupId; + ULONG GroupCount; + [size_is(GroupCount)] PGROUP_MEMBERSHIP GroupIds; + ULONG UserFlags; + USER_SESSION_KEY UserSessionKey; + RPC_UNICODE_STRING LogonServer; + RPC_UNICODE_STRING LogonDomainName; + PRPC_SID LogonDomainId; + ULONG ExpansionRoom[10]; + ULONG SidCount; + [size_is(SidCount)] PNETLOGON_SID_AND_ATTRIBUTES ExtraSids; +} NETLOGON_VALIDATION_SAM_INFO2, *PNETLOGON_VALIDATION_SAM_INFO2 ; + +typedef struct _NETLOGON_VALIDATION_GENERIC_INFO2 +{ + ULONG DataLength; + [size_is(DataLength)] UCHAR *ValidationData; +} NETLOGON_VALIDATION_GENERIC_INFO2, *PNETLOGON_VALIDATION_GENERIC_INFO2; + +typedef struct _NETLOGON_VALIDATION_SAM_INFO4 +{ + OLD_LARGE_INTEGER LogonTime; + OLD_LARGE_INTEGER LogoffTime; + OLD_LARGE_INTEGER KickOffTime; + OLD_LARGE_INTEGER PasswordLastSet; + OLD_LARGE_INTEGER PasswordCanChange; + OLD_LARGE_INTEGER PasswordMustChange; + RPC_UNICODE_STRING EffectiveName; + RPC_UNICODE_STRING FullName; + RPC_UNICODE_STRING LogonScript; + RPC_UNICODE_STRING ProfilePath; + RPC_UNICODE_STRING HomeDirectory; + RPC_UNICODE_STRING HomeDirectoryDrive; + unsigned short LogonCount; + unsigned short BadPasswordCount; + unsigned long UserId; + unsigned long PrimaryGroupId; + unsigned long GroupCount; + [size_is(GroupCount)] PGROUP_MEMBERSHIP GroupIds; + unsigned long UserFlags; + USER_SESSION_KEY UserSessionKey; + RPC_UNICODE_STRING LogonServer; + RPC_UNICODE_STRING LogonDomainName; + PRPC_SID LogonDomainId; + unsigned char LMKey[8]; + ULONG UserAccountControl; + ULONG SubAuthStatus; + OLD_LARGE_INTEGER LastSuccessfulILogon; + OLD_LARGE_INTEGER LastFailedILogon; + ULONG FailedILogonCount; + ULONG Reserved4[1]; + unsigned long SidCount; + [size_is(SidCount)] PNETLOGON_SID_AND_ATTRIBUTES ExtraSids; + RPC_UNICODE_STRING DnsLogonDomainName; + RPC_UNICODE_STRING Upn; + RPC_UNICODE_STRING ExpansionString1; + RPC_UNICODE_STRING ExpansionString2; + RPC_UNICODE_STRING ExpansionString3; + RPC_UNICODE_STRING ExpansionString4; + RPC_UNICODE_STRING ExpansionString5; + RPC_UNICODE_STRING ExpansionString6; + RPC_UNICODE_STRING ExpansionString7; + RPC_UNICODE_STRING ExpansionString8; + RPC_UNICODE_STRING ExpansionString9; + RPC_UNICODE_STRING ExpansionString10; +} NETLOGON_VALIDATION_SAM_INFO4, *PNETLOGON_VALIDATION_SAM_INFO4; + +typedef [switch_type(enum _NETLOGON_VALIDATION_INFO_CLASS)] union _NETLOGON_VALIDATION +{ + [case(NetlogonValidationSamInfo)] PNETLOGON_VALIDATION_SAM_INFO ValidationSam; + [case(NetlogonValidationSamInfo2)] PNETLOGON_VALIDATION_SAM_INFO2 ValidationSam2; + [case(NetlogonValidationGenericInfo2)] PNETLOGON_VALIDATION_GENERIC_INFO2 ValidationGeneric2; + [case(NetlogonValidationSamInfo4)] PNETLOGON_VALIDATION_SAM_INFO4 ValidationSam4; + [default] ; +} NETLOGON_VALIDATION, *PNETLOGON_VALIDATION; + +typedef [switch_type(DWORD)] union _NETLOGON_CONTROL_DATA_INFORMATION +{ + [case(5, 6, 9, 10)] [string] wchar_t *TrustedDomainName; + [case(65534)] DWORD DebugFlag; + [case(8)] [string] wchar_t *UserName; + [default] ; +} NETLOGON_CONTROL_DATA_INFORMATION, *PNETLOGON_CONTROL_DATA_INFORMATION; + +cpp_quote("#ifndef _LMACCESS_H") +typedef struct _NETLOGON_INFO_1 +{ + DWORD netlog1_flags; + NET_API_STATUS netlog1_pdc_connection_status; +} NETLOGON_INFO_1, *PNETLOGON_INFO_1; + +typedef struct _NETLOGON_INFO_2 +{ + DWORD netlog2_flags; + NET_API_STATUS netlog2_pdc_connection_status; + [string] wchar_t *netlog2_trusted_dc_name; + NET_API_STATUS netlog2_tc_connection_status; +} NETLOGON_INFO_2, *PNETLOGON_INFO_2; + +typedef struct _NETLOGON_INFO_3 +{ + DWORD netlog3_flags; + DWORD netlog3_logon_attempts; + DWORD netlog3_reserved1; + DWORD netlog3_reserved2; + DWORD netlog3_reserved3; + DWORD netlog3_reserved4; + DWORD netlog3_reserved5; +} NETLOGON_INFO_3, *PNETLOGON_INFO_3; +cpp_quote("#endif") + +typedef struct _NETLOGON_INFO_4 +{ + [string] wchar_t *netlog4_trusted_dc_name; + [string] wchar_t *netlog4_trusted_domain_name; +} NETLOGON_INFO_4, *PNETLOGON_INFO_4; + +typedef [switch_type(DWORD)] union _NETLOGON_CONTROL_QUERY_INFORMATION +{ + [case(1)] PNETLOGON_INFO_1 NetlogonInfo1; + [case(2)] PNETLOGON_INFO_2 NetlogonInfo2; + [case(3)] PNETLOGON_INFO_3 NetlogonInfo3; + [case(4)] PNETLOGON_INFO_4 NetlogonInfo4; + [default] ; +} NETLOGON_CONTROL_QUERY_INFORMATION, *PNETLOGON_CONTROL_QUERY_INFORMATION; + +typedef enum _SYNC_STATE +{ + NormalState = 0, + DomainState = 1, + GroupState = 2, + UasBuiltInGroupState = 3, + UserState = 4, + GroupMemberState = 5, + AliasState = 6, + AliasMemberState = 7, + SamDoneState = 8 +} SYNC_STATE, *PSYNC_STATE; + +typedef struct _DOMAIN_NAME_BUFFER +{ + ULONG DomainNameByteCount; + [unique, size_is(DomainNameByteCount)] UCHAR *DomainNames; +} DOMAIN_NAME_BUFFER, *PDOMAIN_NAME_BUFFER; + +typedef struct _NETLOGON_LSA_POLICY_INFO +{ + ULONG LsaPolicySize; + [size_is(LsaPolicySize)] UCHAR *LsaPolicy; +} NETLOGON_LSA_POLICY_INFO, *PNETLOGON_LSA_POLICY_INFO; + +typedef struct _NETLOGON_ONE_DOMAIN_INFO +{ + RPC_UNICODE_STRING DomainName; + RPC_UNICODE_STRING DnsDomainName; + RPC_UNICODE_STRING DnsForestName; + GUID DomainGuid; + PRPC_SID DomainSid; + RPC_UNICODE_STRING TrustExtension; + RPC_UNICODE_STRING DummyString2; + RPC_UNICODE_STRING DummyString3; + RPC_UNICODE_STRING DummyString4; + ULONG DummyLong1; + ULONG DummyLong2; + ULONG DummyLong3; + ULONG DummyLong4; +} NETLOGON_ONE_DOMAIN_INFO, *PNETLOGON_ONE_DOMAIN_INFO; + +typedef struct _NETLOGON_DOMAIN_INFO +{ + NETLOGON_ONE_DOMAIN_INFO PrimaryDomain; + ULONG TrustedDomainCount; + [size_is(TrustedDomainCount)] PNETLOGON_ONE_DOMAIN_INFO TrustedDomains; + NETLOGON_LSA_POLICY_INFO LsaPolicy; + RPC_UNICODE_STRING DnsHostNameInDs; + RPC_UNICODE_STRING DummyString2; + RPC_UNICODE_STRING DummyString3; + RPC_UNICODE_STRING DummyString4; + ULONG WorkstationFlags; + ULONG SupportedEncTypes; + ULONG DummyLong3; + ULONG DummyLong4; +} NETLOGON_DOMAIN_INFO, *PNETLOGON_DOMAIN_INFO; + +typedef [switch_type(DWORD)] union _NETLOGON_DOMAIN_INFORMATION +{ + [case(1)] PNETLOGON_DOMAIN_INFO DomainInfo; + [case(2)] PNETLOGON_LSA_POLICY_INFO LsaPolicyInfo; +} NETLOGON_DOMAIN_INFORMATION, *PNETLOGON_DOMAIN_INFORMATION; + +typedef struct _NETLOGON_WORKSTATION_INFO +{ + NETLOGON_LSA_POLICY_INFO LsaPolicy; + [string] wchar_t *DnsHostName; + [string] wchar_t *SiteName; + [string] wchar_t *Dummy1; + [string] wchar_t *Dummy2; + [string] wchar_t *Dummy3; + [string] wchar_t *Dummy4; + RPC_UNICODE_STRING OsVersion; + RPC_UNICODE_STRING OsName; + RPC_UNICODE_STRING DummyString3; + RPC_UNICODE_STRING DummyString4; + ULONG WorkstationFlags; + ULONG KerberosSupportedEncryptionTypes; + ULONG DummyLong3; + ULONG DummyLong4; +} NETLOGON_WORKSTATION_INFO, *PNETLOGON_WORKSTATION_INFO; + +typedef [switch_type(DWORD)] union _NETLOGON_WORKSTATION_INFORMATION +{ + [case(1)] PNETLOGON_WORKSTATION_INFO WorkstationInfo; + [case(2)] PNETLOGON_WORKSTATION_INFO LsaPolicyInfo; +} NETLOGON_WORKSTATION_INFORMATION, *PNETLOGON_WORKSTATION_INFORMATION; + +typedef struct _NL_SOCKET_ADDRESS +{ + [size_is(iSockaddrLength)] UCHAR *lpSockaddr; + ULONG iSockaddrLength; +} NL_SOCKET_ADDRESS, *PNL_SOCKET_ADDRESS; + +typedef struct _NL_SITE_NAME_ARRAY +{ + ULONG EntryCount; + [size_is(EntryCount)] PRPC_UNICODE_STRING SiteNames; +} NL_SITE_NAME_ARRAY, *PNL_SITE_NAME_ARRAY; + +typedef struct _DS_DOMAIN_TRUSTSW +{ + [string] wchar_t *NetbiosDomainName; + [string] wchar_t *DnsDomainName; + ULONG Flags; + ULONG ParentIndex; + ULONG TrustType; + ULONG TrustAttributes; + PRPC_SID DomainSid; + GUID DomainGuid; +} DS_DOMAIN_TRUSTSW, *PDS_DOMAIN_TRUSTSW; + +typedef struct _NETLOGON_TRUSTED_DOMAIN_ARRAY +{ + DWORD DomainCount; + [size_is(DomainCount)] PDS_DOMAIN_TRUSTSW Domains; +} NETLOGON_TRUSTED_DOMAIN_ARRAY, *PNETLOGON_TRUSTED_DOMAIN_ARRAY; + +typedef struct _NL_SITE_NAME_EX_ARRAY +{ + ULONG EntryCount; + [size_is(EntryCount)] PRPC_UNICODE_STRING SiteNames; + [size_is(EntryCount)] PRPC_UNICODE_STRING SubnetNames; +} NL_SITE_NAME_EX_ARRAY, *PNL_SITE_NAME_EX_ARRAY; + +typedef struct _NL_GENERIC_RPC_DATA +{ + ULONG UlongEntryCount; + [size_is(UlongEntryCount)] ULONG *UlongData; + ULONG UnicodeStringEntryCount; + [size_is(UnicodeStringEntryCount)] PRPC_UNICODE_STRING UnicodeStringData; +} NL_GENERIC_RPC_DATA, *PNL_GENERIC_RPC_DATA; + +typedef struct _NETLOGON_VALIDATION_UAS_INFO +{ + [string] wchar_t *usrlog1_eff_name; + DWORD usrlog1_priv; + DWORD usrlog1_auth_flags; + DWORD usrlog1_num_logons; + DWORD usrlog1_bad_pw_count; + DWORD usrlog1_last_logon; + DWORD usrlog1_last_logoff; + DWORD usrlog1_logoff_time; + DWORD usrlog1_kickoff_time; + DWORD usrlog1_password_age; + DWORD usrlog1_pw_can_change; + DWORD usrlog1_pw_must_change; + [string] wchar_t *usrlog1_computer; + [string] wchar_t *usrlog1_domain; + [string] wchar_t *usrlog1_script_path; + DWORD usrlog1_reserved1; +} NETLOGON_VALIDATION_UAS_INFO, *PNETLOGON_VALIDATION_UAS_INFO; + +typedef struct _NETLOGON_LOGOFF_UAS_INFO +{ + DWORD Duration; + USHORT LogonCount; +} NETLOGON_LOGOFF_UAS_INFORMATION, *PNETLOGON_LOGOFF_UAS_INFO; + +typedef [switch_type(DWORD)] union _NETLOGON_CAPABILITIES +{ + [case(1)] ULONG ServerCapabilities; +} NETLOGON_CAPABILITIES, *PNETLOGON_CAPABILITIES; + +typedef struct _NETLOGON_CREDENTIAL +{ + CHAR data[8]; +} NETLOGON_CREDENTIAL, *PNETLOGON_CREDENTIAL; + +typedef struct _NETLOGON_AUTHENTICATOR +{ + NETLOGON_CREDENTIAL Credential; + DWORD Timestamp; +} NETLOGON_AUTHENTICATOR, *PNETLOGON_AUTHENTICATOR; + +typedef enum _NETLOGON_SECURE_CHANNEL_TYPE +{ + NullSecureChannel = 0, + MsvApSecureChannel = 1, + WorkstationSecureChannel = 2, + TrustedDnsDomainSecureChannel = 3, + TrustedDomainSecureChannel = 4, + UasServerSecureChannel = 5, + ServerSecureChannel = 6, + CdcServerSecureChannel = 7 +} NETLOGON_SECURE_CHANNEL_TYPE; + +typedef struct _UAS_INFO_0 +{ + CHAR ComputerName[16]; + ULONG TimeCreated; + ULONG SerialNumber; +} UAS_INFO_0, *PUAS_INFO_0; + +typedef struct _DOMAIN_CONTROLLER_INFOW +{ + [string, unique] wchar_t *DomainControllerName; + [string, unique] wchar_t *DomainControllerAddress; + ULONG DomainControllerAddressType; + GUID DomainGuid; + [string, unique] wchar_t *DomainName; + [string, unique] wchar_t *DnsForestName; + ULONG Flags; + [string, unique] wchar_t *DcSiteName; + [string, unique] wchar_t *ClientSiteName; +} DOMAIN_CONTROLLER_INFOW, *PDOMAIN_CONTROLLER_INFOW; + +typedef struct _NL_TRUST_PASSWORD +{ + WCHAR Buffer[256]; + ULONG Length; +} NL_TRUST_PASSWORD, *PNL_TRUST_PASSWORD; + +typedef struct _NL_PASSWORD_VERSION +{ + ULONG ReservedField; + ULONG PasswordVersionNumber; + ULONG PasswordVersionPresent; +} NL_PASSWORD_VERSION, *PNL_PASSWORD_VERSION; + +cpp_quote("#ifndef _NTSECAPI_H") +typedef enum _LSA_FOREST_TRUST_RECORD_TYPE +{ + ForestTrustTopLevelName = 0, + ForestTrustTopLevelNameEx = 1, + ForestTrustDomainInfo = 2, +} LSA_FOREST_TRUST_RECORD_TYPE; + +typedef RPC_UNICODE_STRING LSA_RPC_UNICODE_STRING, *PLSA_RPC_UNICODE_STRING; + +typedef struct _LSA_FOREST_TRUST_DOMAIN_INFO +{ + PRPC_SID Sid; + LSA_RPC_UNICODE_STRING DnsName; + LSA_RPC_UNICODE_STRING NetbiosName; +} LSA_FOREST_TRUST_DOMAIN_INFO, *PLSA_FOREST_TRUST_DOMAIN_INFO; + +typedef struct _LSA_FOREST_TRUST_BINARY_DATA +{ + [range(0, 131072)] ULONG Length; + [size_is(Length)] UCHAR * Buffer; +} LSA_FOREST_TRUST_BINARY_DATA, *PLSA_FOREST_TRUST_BINARY_DATA; + +typedef struct _LSA_FOREST_TRUST_RECORD +{ + ULONG Flags; + LSA_FOREST_TRUST_RECORD_TYPE ForestTrustType; + LARGE_INTEGER Time; + [switch_type( LSA_FOREST_TRUST_RECORD_TYPE ), switch_is(ForestTrustType)] union + { + [case(ForestTrustTopLevelName, ForestTrustTopLevelNameEx)] LSA_RPC_UNICODE_STRING TopLevelName; + [case(ForestTrustDomainInfo)] LSA_FOREST_TRUST_DOMAIN_INFO DomainInfo; + [default] LSA_FOREST_TRUST_BINARY_DATA Data; + } ForestTrustData; +} LSA_FOREST_TRUST_RECORD, *PLSA_FOREST_TRUST_RECORD; + +typedef struct _LSA_FOREST_TRUST_INFORMATION +{ + [range(0, 4000)] ULONG RecordCount; + [size_is(RecordCount)] PLSA_FOREST_TRUST_RECORD *Entries; +} LSA_FOREST_TRUST_INFORMATION, *PLSA_FOREST_TRUST_INFORMATION; +cpp_quote("#endif") + + +[ + uuid(12345678-1234-ABCD-EF00-01234567CFFB), + version(1.0), +#ifdef __midl + ms_union, +#endif + pointer_default(unique) +#ifndef __midl + ,implicit_handle(handle_t hBinding) +#endif +] +interface logon +{ + /* Function 0 */ + NET_API_STATUS + __stdcall + NetrLogonUasLogon( + [in, unique, string] LOGONSRV_HANDLE ServerName, + [in, string] wchar_t *UserName, + [in, string] wchar_t *Workstation, + [out] PNETLOGON_VALIDATION_UAS_INFO *ValidationInformation); + + /* Function 1 */ + NET_API_STATUS + __stdcall + NetrLogonUasLogoff( + [in, unique, string] LOGONSRV_HANDLE ServerName, + [in, string] wchar_t *UserName, + [in, string] wchar_t *Workstation, + [out] PNETLOGON_LOGOFF_UAS_INFO LogoffInformation); + + /* Function 2 */ + NTSTATUS + __stdcall + NetrLogonSamLogon( + [in, unique, string] LOGONSRV_HANDLE LogonServer, + [in, string, unique] wchar_t *ComputerName, + [in, unique] PNETLOGON_AUTHENTICATOR Authenticator, + [in, out, unique] PNETLOGON_AUTHENTICATOR ReturnAuthenticator, + [in] NETLOGON_LOGON_INFO_CLASS LogonLevel, + [in, switch_is(LogonLevel)] PNETLOGON_LEVEL LogonInformation, + [in] NETLOGON_VALIDATION_INFO_CLASS ValidationLevel, + [out, switch_is(ValidationLevel)] PNETLOGON_VALIDATION ValidationInformation, + [out] UCHAR *Authoritative); + + /* Function 3 */ + NTSTATUS + __stdcall + NetrLogonSamLogoff( + [in, unique, string] LOGONSRV_HANDLE LogonServer, + [in, string, unique] wchar_t *ComputerName, + [in, unique] PNETLOGON_AUTHENTICATOR Authenticator, + [in, out, unique] PNETLOGON_AUTHENTICATOR ReturnAuthenticator, + [in] NETLOGON_LOGON_INFO_CLASS LogonLevel, + [in, switch_is(LogonLevel)] PNETLOGON_LEVEL LogonInformation); + + /* Function 4 */ + NTSTATUS + __stdcall + NetrServerReqChallenge( + [in, unique, string] LOGONSRV_HANDLE PrimaryName, + [in, string] wchar_t *ComputerName, + [in] PNETLOGON_CREDENTIAL ClientChallenge, + [out] PNETLOGON_CREDENTIAL ServerChallenge); + + /* Function 5 */ + NTSTATUS + __stdcall + NetrServerAuthenticate( + [in, unique, string] LOGONSRV_HANDLE PrimaryName, + [in, string] wchar_t *AccountName, + [in] NETLOGON_SECURE_CHANNEL_TYPE SecureChannelType, + [in, string] wchar_t *ComputerName, + [in] PNETLOGON_CREDENTIAL ClientCredential, + [out] PNETLOGON_CREDENTIAL ServerCredential); + + /* Function 6 */ + NTSTATUS + __stdcall + NetrServerPasswordSet( + [in, unique, string] LOGONSRV_HANDLE PrimaryName, + [in, string] wchar_t *AccountName, + [in] NETLOGON_SECURE_CHANNEL_TYPE SecureChannelType, + [in, string] wchar_t *ComputerName, + [in] PNETLOGON_AUTHENTICATOR Authenticator, + [out] PNETLOGON_AUTHENTICATOR ReturnAuthenticator, + [in] PENCRYPTED_NT_OWF_PASSWORD UasNewPassword); + + /* Function 7 */ + NTSTATUS + __stdcall + NetrDatabaseDeltas( + [in, string] LOGONSRV_HANDLE PrimaryName, + [in, string] wchar_t *ComputerName, + [in] PNETLOGON_AUTHENTICATOR Authenticator, + [in, out] PNETLOGON_AUTHENTICATOR ReturnAuthenticator, + [in] DWORD DatabaseID, + [in, out] PNLPR_MODIFIED_COUNT DomainModifiedCount, + [out] PNETLOGON_DELTA_ENUM_ARRAY *DeltaArray, + [in] DWORD PreferredMaximumLength); + + /* Function 8 */ + NTSTATUS + __stdcall + NetrDatabaseSync( + [in, string] LOGONSRV_HANDLE PrimaryName, + [in, string] wchar_t *ComputerName, + [in] PNETLOGON_AUTHENTICATOR Authenticator, + [in, out] PNETLOGON_AUTHENTICATOR ReturnAuthenticator, + [in] DWORD DatabaseID, + [in, out] ULONG *SyncContext, + [out] PNETLOGON_DELTA_ENUM_ARRAY *DeltaArray, + [in] DWORD PreferredMaximumLength); + + /* Function 9 */ + NTSTATUS + __stdcall + NetrAccountDeltas( + [in, unique, string] LOGONSRV_HANDLE PrimaryName, + [in, string] wchar_t * ComputerName, + [in] PNETLOGON_AUTHENTICATOR Authenticator, + [in, out] PNETLOGON_AUTHENTICATOR ReturnAuthenticator, + [in] PUAS_INFO_0 RecordId, + [in] DWORD Count, + [in] DWORD Level, + [out, size_is(BufferSize)] UCHAR *Buffer, + [in] DWORD BufferSize, + [out] ULONG *CountReturned, + [out] ULONG *TotalEntries, + [out] PUAS_INFO_0 NextRecordId); + + /* Function 10 */ + NTSTATUS + __stdcall + NetrAccountSync( + [in, unique, string] LOGONSRV_HANDLE PrimaryName, + [in, string] wchar_t *ComputerName, + [in] PNETLOGON_AUTHENTICATOR Authenticator, + [in, out] PNETLOGON_AUTHENTICATOR ReturnAuthenticator, + [in] DWORD Reference, + [in] DWORD Level, + [out, size_is(BufferSize)] UCHAR *Buffer, + [in] DWORD BufferSize, + [out] ULONG *CountReturned, + [out] ULONG *TotalEntries, + [out] ULONG *NextReference, + [out] PUAS_INFO_0 LastRecordId); + + /* Function 11 */ + NET_API_STATUS + __stdcall + NetrGetDCName( + [in, string] LOGONSRV_HANDLE ServerName, + [in, unique, string] wchar_t *DomainName, + [out, string] wchar_t **Buffer); + + /* Function 12 */ + NET_API_STATUS + __stdcall + NetrLogonControl( + [in, unique, string] LOGONSRV_HANDLE ServerName, + [in] DWORD FunctionCode, + [in] DWORD QueryLevel, + [out, switch_is(QueryLevel)] PNETLOGON_CONTROL_QUERY_INFORMATION Buffer); + + /* Function 13 */ + NET_API_STATUS + __stdcall + NetrGetAnyDCName( + [in, unique, string] LOGONSRV_HANDLE ServerName, + [in, unique, string] wchar_t *DomainName, + [out, string] wchar_t **Buffer); + + /* Function 14 */ + NET_API_STATUS + __stdcall + NetrLogonControl2( + [in, unique, string] LOGONSRV_HANDLE ServerName, + [in] DWORD FunctionCode, + [in] DWORD QueryLevel, + [in, switch_is(FunctionCode)] PNETLOGON_CONTROL_DATA_INFORMATION Data, + [out, switch_is(QueryLevel)] PNETLOGON_CONTROL_QUERY_INFORMATION Buffer); + + /* Function 15 */ + NTSTATUS + __stdcall + NetrServerAuthenticate2( + [in, unique, string] LOGONSRV_HANDLE PrimaryName, + [in, string] wchar_t *AccountName, + [in] NETLOGON_SECURE_CHANNEL_TYPE SecureChannelType, + [in, string] wchar_t *ComputerName, + [in] PNETLOGON_CREDENTIAL ClientCredential, + [out] PNETLOGON_CREDENTIAL ServerCredential, + [in, out] ULONG *NegotiateFlags); + + /* Function 16 */ + NTSTATUS + __stdcall + NetrDatabaseSync2( + [in, string] LOGONSRV_HANDLE PrimaryName, + [in, string] wchar_t *ComputerName, + [in] PNETLOGON_AUTHENTICATOR Authenticator, + [in, out] PNETLOGON_AUTHENTICATOR ReturnAuthenticator, + [in] DWORD DatabaseID, + [in] SYNC_STATE RestartState, + [in, out] ULONG *SyncContext, + [out] PNETLOGON_DELTA_ENUM_ARRAY *DeltaArray, + [in] DWORD PreferredMaximumLength); + + /* Function 17 */ + NTSTATUS + __stdcall + NetrDatabaseRedo( + [in, string] LOGONSRV_HANDLE PrimaryName, + [in, string] wchar_t *ComputerName, + [in] PNETLOGON_AUTHENTICATOR Authenticator, + [in, out] PNETLOGON_AUTHENTICATOR ReturnAuthenticator, + [in, size_is(ChangeLogEntrySize)] UCHAR *ChangeLogEntry, + [in] DWORD ChangeLogEntrySize, + [out] PNETLOGON_DELTA_ENUM_ARRAY *DeltaArray); + + /* Function 18 */ + NET_API_STATUS + __stdcall + NetrLogonControl2Ex( + [in, unique, string] LOGONSRV_HANDLE ServerName, + [in] DWORD FunctionCode, + [in] DWORD QueryLevel, + [in, switch_is(FunctionCode)] PNETLOGON_CONTROL_DATA_INFORMATION Data, + [out, switch_is(QueryLevel)] PNETLOGON_CONTROL_QUERY_INFORMATION Buffer); + + /* Function 19 */ + NTSTATUS + __stdcall + NetrEnumerateTrustedDomains( + [in, unique, string] LOGONSRV_HANDLE ServerName, + [out] PDOMAIN_NAME_BUFFER DomainNameBuffer); + + /* Function 20 */ + NET_API_STATUS + __stdcall + DsrGetDcName( + [in, unique, string] LOGONSRV_HANDLE ComputerName, + [in, unique, string] wchar_t *DomainName, + [in, unique] GUID *DomainGuid, + [in, unique] GUID *SiteGuid, + [in] ULONG Flags, + [out] PDOMAIN_CONTROLLER_INFOW *DomainControllerInfo); + + /* Function 21 */ + NTSTATUS + __stdcall + NetrLogonGetCapabilities( + [in, string] LOGONSRV_HANDLE ServerName, + [in, string, unique] wchar_t *ComputerName, + [in] PNETLOGON_AUTHENTICATOR Authenticator, + [in, out] PNETLOGON_AUTHENTICATOR ReturnAuthenticator, + [in] DWORD QueryLevel, + [out, switch_is(QueryLevel)] PNETLOGON_CAPABILITIES ServerCapabilities); + + /* Function 22 */ + NTSTATUS + __stdcall + NetrLogonSetServiceBits( + [in, unique, string] LOGONSRV_HANDLE ServerName, + [in] DWORD ServiceBitsOfInterest, + [in] DWORD ServiceBits); + + /* Function 23 */ + NET_API_STATUS + __stdcall + NetrLogonGetTrustRid( + [in, unique, string] LOGONSRV_HANDLE ServerName, + [in, string, unique] wchar_t *DomainName, + [out] ULONG *Rid); + + /* Function 24 */ + NET_API_STATUS + __stdcall + NetrLogonComputeServerDigest( + [in, unique, string] LOGONSRV_HANDLE ServerName, + [in] ULONG Rid, + [in, size_is(MessageSize)] UCHAR *Message, + [in] ULONG MessageSize, + [out] CHAR NewMessageDigest[16], + [out] CHAR OldMessageDigest[16]); + + /* Function 25 */ + NET_API_STATUS + __stdcall + NetrLogonComputeClientDigest( + [in, unique, string] LOGONSRV_HANDLE ServerName, + [in, string, unique] wchar_t *DomainName, + [in, size_is(MessageSize)] UCHAR *Message, + [in] ULONG MessageSize, + [out] CHAR NewMessageDigest[16], + [out] CHAR OldMessageDigest[16]); + + /* Function 26 */ + NTSTATUS + __stdcall + NetrServerAuthenticate3( + [in, unique, string] LOGONSRV_HANDLE PrimaryName, + [in, string] wchar_t *AccountName, + [in] NETLOGON_SECURE_CHANNEL_TYPE SecureChannelType, + [in, string] wchar_t *ComputerName, + [in] PNETLOGON_CREDENTIAL ClientCredential, + [out] PNETLOGON_CREDENTIAL ServerCredential, + [in,out] ULONG *NegotiateFlags, + [out] ULONG *AccountRid); + + /* Function 27 */ + NET_API_STATUS + __stdcall + DsrGetDcNameEx( + [in, unique, string] LOGONSRV_HANDLE ComputerName, + [in, unique, string] wchar_t *DomainName, + [in, unique] GUID *DomainGuid, + [in, unique, string] wchar_t *SiteName, + [in] ULONG Flags, + [out] PDOMAIN_CONTROLLER_INFOW *DomainControllerInfo); + + /* Function 28 */ + NET_API_STATUS + __stdcall + DsrGetSiteName( + [in, unique, string] LOGONSRV_HANDLE ComputerName, + [out, string] wchar_t **SiteName); + + /* Function 29 */ + NTSTATUS + __stdcall + NetrLogonGetDomainInfo( + [in, string] LOGONSRV_HANDLE ServerName, + [in, string, unique] wchar_t *ComputerName, + [in] PNETLOGON_AUTHENTICATOR Authenticator, + [in, out] PNETLOGON_AUTHENTICATOR ReturnAuthenticator, + [in] DWORD Level, + [in, switch_is(Level)] PNETLOGON_WORKSTATION_INFORMATION WkstaBuffer, + [out, switch_is(Level)] PNETLOGON_DOMAIN_INFORMATION DomBuffer); + + /* Function 30 */ + NTSTATUS + __stdcall + NetrServerPasswordSet2( + [in, unique, string] LOGONSRV_HANDLE PrimaryName, + [in, string] wchar_t *AccountName, + [in] NETLOGON_SECURE_CHANNEL_TYPE SecureChannelType, + [in, string] wchar_t *ComputerName, + [in] PNETLOGON_AUTHENTICATOR Authenticator, + [out] PNETLOGON_AUTHENTICATOR ReturnAuthenticator, + [in] PNL_TRUST_PASSWORD ClearNewPassword); + + /* Function 31 */ + NTSTATUS + __stdcall + NetrServerPasswordGet( + [in, unique, string] LOGONSRV_HANDLE PrimaryName, + [in, string] wchar_t *AccountName, + [in] NETLOGON_SECURE_CHANNEL_TYPE AccountType, + [in, string] wchar_t *ComputerName, + [in] PNETLOGON_AUTHENTICATOR Authenticator, + [out] PNETLOGON_AUTHENTICATOR ReturnAuthenticator, + [out] PENCRYPTED_NT_OWF_PASSWORD EncryptedNtOwfPassword); + + /* Function 32 */ + NTSTATUS + __stdcall + NetrLogonSendToSam( + [in, unique, string] LOGONSRV_HANDLE PrimaryName, + [in, string] wchar_t *ComputerName, + [in] PNETLOGON_AUTHENTICATOR Authenticator, + [out] PNETLOGON_AUTHENTICATOR ReturnAuthenticator, + [in, size_is(OpaqueBufferSize)] UCHAR *OpaqueBuffer, + [in] ULONG OpaqueBufferSize); + + /* Function 33 */ + NET_API_STATUS + __stdcall + DsrAddressToSiteNamesW( + [in, unique, string] LOGONSRV_HANDLE ComputerName, + [in, range(0, 32000)] DWORD EntryCount, + [in, size_is(EntryCount)] PNL_SOCKET_ADDRESS SocketAddresses, + [out] PNL_SITE_NAME_ARRAY *SiteNames); + + /* Function 34 */ + NET_API_STATUS + __stdcall + DsrGetDcNameEx2( + [in, unique, string] LOGONSRV_HANDLE ComputerName, + [in, unique, string] wchar_t *AccountName, + [in] ULONG AllowableAccountControlBits, + [in, unique, string] wchar_t *DomainName, + [in, unique] GUID *DomainGuid, + [in, unique, string] wchar_t *SiteName, + [in] ULONG Flags, + [out] PDOMAIN_CONTROLLER_INFOW *DomainControllerInfo); + + /* Function 35 */ + NET_API_STATUS + __stdcall + NetrLogonGetTimeServiceParentDomain( + [in, unique, string] LOGONSRV_HANDLE ServerName, + [out, string] wchar_t **DomainName, + [out] int *PdcSameSite); + + /* Function 36 */ + NET_API_STATUS + __stdcall + NetrEnumerateTrustedDomainsEx( + [in, unique, string] LOGONSRV_HANDLE ServerName, + [out] PNETLOGON_TRUSTED_DOMAIN_ARRAY Domains); + + /* Function 37 */ + NET_API_STATUS + __stdcall + DsrAddressToSiteNamesExW( + [in, unique, string] LOGONSRV_HANDLE ComputerName, + [in, range(0, 32000)] DWORD EntryCount, + [in, size_is(EntryCount)] PNL_SOCKET_ADDRESS SocketAddresses, + [out] PNL_SITE_NAME_EX_ARRAY *SiteNames); + + /* Function 38 */ + NET_API_STATUS + __stdcall + DsrGetDcSiteCoverageW( + [in, unique, string] LOGONSRV_HANDLE ServerName, + [out] PNL_SITE_NAME_ARRAY *SiteNames); + + /* Function 39 */ + NTSTATUS + __stdcall + NetrLogonSamLogonEx( + [in] handle_t ContextHandle, + [in, unique, string] wchar_t *LogonServer, + [in, unique, string] wchar_t *ComputerName, + [in] NETLOGON_LOGON_INFO_CLASS LogonLevel, + [in, switch_is(LogonLevel)] PNETLOGON_LEVEL LogonInformation, + [in] NETLOGON_VALIDATION_INFO_CLASS ValidationLevel, + [out, switch_is(ValidationLevel)] PNETLOGON_VALIDATION ValidationInformation, + [out] UCHAR *Authoritative, + [in,out] ULONG *ExtraFlags); + + /* Function 40 */ + NET_API_STATUS + __stdcall + DsrEnumerateDomainTrusts( + [in, unique, string] LOGONSRV_HANDLE ServerName, + [in] ULONG Flags, + [out] PNETLOGON_TRUSTED_DOMAIN_ARRAY Domains); + + /* Function 41 */ + NET_API_STATUS + __stdcall + DsrDeregisterDnsHostRecords ( + [in, unique, string] LOGONSRV_HANDLE ServerName, + [in, unique, string] wchar_t *DnsDomainName, + [in, unique] GUID *DomainGuid, + [in, unique] GUID *DsaGuid, + [in, string] wchar_t *DnsHostName); + + /* Function 42 */ + NTSTATUS + __stdcall + NetrServerTrustPasswordsGet( + [in, unique, string] LOGONSRV_HANDLE TrustedDcName, + [in, string] wchar_t *AccountName, + [in] NETLOGON_SECURE_CHANNEL_TYPE SecureChannelType, + [in, string] wchar_t *ComputerName, + [in] PNETLOGON_AUTHENTICATOR Authenticator, + [out] PNETLOGON_AUTHENTICATOR ReturnAuthenticator, + [out] PENCRYPTED_NT_OWF_PASSWORD EncryptedNewOwfPassword, + [out] PENCRYPTED_NT_OWF_PASSWORD EncryptedOldOwfPassword); + + /* Function 43 */ + NET_API_STATUS + __stdcall + DsrGetForestTrustInformation( + [in, unique, string] LOGONSRV_HANDLE ServerName, + [in, unique, string] wchar_t *TrustedDomainName, + [in] DWORD Flags, + [out] PLSA_FOREST_TRUST_INFORMATION *ForestTrustInfo); + + /* Function 44 */ + NTSTATUS + __stdcall + NetrGetForestTrustInformation( + [in, unique, string] LOGONSRV_HANDLE ServerName, + [in, string] wchar_t *ComputerName, + [in] PNETLOGON_AUTHENTICATOR Authenticator, + [out] PNETLOGON_AUTHENTICATOR ReturnAuthenticator, + [in] DWORD Flags, + [out] PLSA_FOREST_TRUST_INFORMATION *ForestTrustInfo); + + /* Function 45 */ + NTSTATUS + __stdcall + NetrLogonSamLogonWithFlags( + [in, unique, string] LOGONSRV_HANDLE LogonServer, + [in, string, unique] wchar_t *ComputerName, + [in, unique] PNETLOGON_AUTHENTICATOR Authenticator, + [in, out, unique] PNETLOGON_AUTHENTICATOR ReturnAuthenticator, + [in] NETLOGON_LOGON_INFO_CLASS LogonLevel, + [in, switch_is(LogonLevel)] PNETLOGON_LEVEL LogonInformation, + [in] NETLOGON_VALIDATION_INFO_CLASS ValidationLevel, + [out, switch_is(ValidationLevel)] PNETLOGON_VALIDATION ValidationInformation, + [out] UCHAR *Authoritative, + [in,out] ULONG *ExtraFlags); + + /* Function 46 */ + NTSTATUS + __stdcall + NetrServerGetTrustInfo( + [in, unique, string] LOGONSRV_HANDLE TrustedDcName, + [in, string] wchar_t *AccountName, + [in] NETLOGON_SECURE_CHANNEL_TYPE SecureChannelType, + [in, string] wchar_t *ComputerName, + [in] PNETLOGON_AUTHENTICATOR Authenticator, + [out] PNETLOGON_AUTHENTICATOR ReturnAuthenticator, + [out] PENCRYPTED_NT_OWF_PASSWORD EncryptedNewOwfPassword, + [out] PENCRYPTED_NT_OWF_PASSWORD EncryptedOldOwfPassword, + [out] PNL_GENERIC_RPC_DATA *TrustInfo); +} Propchange: trunk/reactos/sdk/include/reactos/idl/netlogon.idl ------------------------------------------------------------------------------ svn:eol-style = native
7 years, 6 months
1
0
0
0
[ekohl] 75196: [NETAPI32] Implement I_BrowserrDebugTrace and I_BrowserServerEnum. This functions calls their counterpart in the computer browser service.
by ekohl@svn.reactos.org
Author: ekohl Date: Sun Jun 25 12:14:35 2017 New Revision: 75196 URL:
http://svn.reactos.org/svn/reactos?rev=75196&view=rev
Log: [NETAPI32] Implement I_BrowserrDebugTrace and I_BrowserServerEnum. This functions calls their counterpart in the computer browser service. Modified: trunk/reactos/dll/win32/netapi32/browser.c trunk/reactos/dll/win32/netapi32/netapi32.spec trunk/reactos/sdk/include/reactos/idl/browser.idl Modified: trunk/reactos/dll/win32/netapi32/browser.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/browser…
============================================================================== --- trunk/reactos/dll/win32/netapi32/browser.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/netapi32/browser.c [iso-8859-1] Sun Jun 25 12:14:35 2017 @@ -77,6 +77,32 @@ NET_API_STATUS WINAPI +I_BrowserDebugTrace( + _In_opt_ LPWSTR ServerName, + _In_ PCHAR Buffer) +{ + NET_API_STATUS status; + + TRACE("I_BrowserDebugTrace(%s %s)\n", + debugstr_w(ServerName), Buffer); + + RpcTryExcept + { + status = I_BrowserrDebugTrace(ServerName, + Buffer); + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + status = I_RpcMapWin32Status(RpcExceptionCode()); + } + RpcEndExcept; + + return status; +} + + +NET_API_STATUS +WINAPI I_BrowserQueryEmulatedDomains( _In_opt_ LPWSTR ServerName, _Out_ PBROWSER_EMULATED_DOMAIN *EmulatedDomains, @@ -135,6 +161,61 @@ status = I_BrowserrQueryOtherDomains((PWSTR)ServerName, &EnumStruct, TotalEntries); + + if (status == NERR_Success || status == ERROR_MORE_DATA) + { + *BufPtr = (LPBYTE)EnumStruct.ServerInfo.Level100->Buffer; + *EntriesRead = EnumStruct.ServerInfo.Level100->EntriesRead; + } + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + status = I_RpcMapWin32Status(RpcExceptionCode()); + } + RpcEndExcept; + + return status; +} + + +NET_API_STATUS +WINAPI +I_BrowserServerEnum( + _In_opt_ LPCWSTR ServerName, + _In_opt_ LPCWSTR Transport, + _In_opt_ LPCWSTR ClientName, + _In_ DWORD Level, + _Out_ LPBYTE *BufPtr, + _In_ DWORD PrefMaxLen, + _Out_ LPDWORD EntriesRead, + _Out_ LPDWORD TotalEntries, + _In_ DWORD ServerType, + _In_opt_ LPCWSTR Domain, + _Inout_opt_ LPDWORD ResumeHandle) +{ + SERVER_INFO_100_CONTAINER Level100Container = {0, NULL}; + SERVER_ENUM_STRUCT EnumStruct; + NET_API_STATUS status; + + TRACE("I_BrowserServerEnum(%s %s %s %lu %p %lu %p %p %lu %s %p)\n", + debugstr_w(ServerName), debugstr_w(Transport), debugstr_w(ClientName), + Level, BufPtr, PrefMaxLen, EntriesRead, TotalEntries, ServerType, + debugstr_w(Domain), ResumeHandle); + + EnumStruct.Level = 100; + EnumStruct.ServerInfo.Level100 = &Level100Container; + + RpcTryExcept + { + status = I_BrowserrServerEnum((PWSTR)ServerName, + (PWSTR)Transport, + (PWSTR)ClientName, + &EnumStruct, + PrefMaxLen, + TotalEntries, + ServerType, + (PWSTR)Domain, + ResumeHandle); if (status == NERR_Success || status == ERROR_MORE_DATA) { Modified: trunk/reactos/dll/win32/netapi32/netapi32.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/netapi3…
============================================================================== --- trunk/reactos/dll/win32/netapi32/netapi32.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/netapi32/netapi32.spec [iso-8859-1] Sun Jun 25 12:14:35 2017 @@ -39,13 +39,13 @@ @ stub DsValidateSubnetNameA @ stub DsValidateSubnetNameW @ stub I_BrowserDebugCall -@ stub I_BrowserDebugTrace +@ stdcall I_BrowserDebugTrace(wstr str) @ stdcall I_BrowserQueryEmulatedDomains(wstr ptr ptr) @ stdcall I_BrowserQueryOtherDomains(wstr ptr ptr ptr) @ stdcall I_BrowserQueryStatistics(wstr ptr) @ stdcall I_BrowserResetNetlogonState(wstr) @ stdcall I_BrowserResetStatistics(wstr) -@ stub I_BrowserServerEnum +@ stdcall I_BrowserServerEnum(wstr wstr wstr long ptr long ptr ptr long wstr ptr) @ stdcall I_BrowserSetNetlogonState(wstr wstr wstr long) @ stub I_NetAccountDeltas @ stub I_NetAccountSync Modified: trunk/reactos/sdk/include/reactos/idl/browser.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/reactos/idl/br…
============================================================================== --- trunk/reactos/sdk/include/reactos/idl/browser.idl [iso-8859-1] (original) +++ trunk/reactos/sdk/include/reactos/idl/browser.idl [iso-8859-1] Sun Jun 25 12:14:35 2017 @@ -138,10 +138,19 @@ ] interface browser { - /* Function 0 (BrowserrServerEnum) */ - NET_API_STATUS - __stdcall - BrowserOpnum0NotUsedOnWire(void); + /* Function 0 */ + NET_API_STATUS + __stdcall + I_BrowserrServerEnum( + [in, string, unique] BROWSER_IDENTIFY_HANDLE ServerName, + [in, string, unique] LPWSTR Transport, + [in, string, unique] LPWSTR ClientName, + [in, out] LPSERVER_ENUM_STRUCT EnumStruct, + [in] DWORD PreferedMaximumLength, + [out] LPDWORD TotalEntries, + [in] DWORD ServerType, + [in, string, unique] LPWSTR Domain, + [in, out, unique] LPDWORD ResumeHandle); /* Function 1 (BrowserrDebugCall) */ NET_API_STATUS @@ -153,7 +162,7 @@ __stdcall I_BrowserrQueryOtherDomains( [in, string, unique] BROWSER_IDENTIFY_HANDLE ServerName, - [in, out] LPSERVER_ENUM_STRUCT InfoStruct, + [in, out] LPSERVER_ENUM_STRUCT EnumStruct, [out] LPDWORD TotalEntries); /* Function 3 */ @@ -162,10 +171,12 @@ I_BrowserrResetNetlogonState( [in, string, unique] BROWSER_IDENTIFY_HANDLE ServerName); - /* Function 4 (BrowserrDebugTrace) */ - NET_API_STATUS - __stdcall - BrowserOpnum4NotUsedOnWire(void); + /* Function 4 */ + NET_API_STATUS + __stdcall + I_BrowserrDebugTrace( + [in, string, unique] BROWSER_IDENTIFY_HANDLE ServerName, + [in, string] LPSTR String); /* Function 5 */ NET_API_STATUS
7 years, 6 months
1
0
0
0
[pschweitzer] 75195: [RXCE] - Implemented RxCompleteSrvOpenKeyAssociation(), RxInitiateSrvOpenKeyAssociation(), RxProcessChangeBufferingStateRequests() - Implemented RxFinalizeFcbTable(), RxFinaliz...
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Sun Jun 25 11:55:37 2017 New Revision: 75195 URL:
http://svn.reactos.org/svn/reactos?rev=75195&view=rev
Log: [RXCE] - Implemented RxCompleteSrvOpenKeyAssociation(), RxInitiateSrvOpenKeyAssociation(), RxProcessChangeBufferingStateRequests() - Implemented RxFinalizeFcbTable(), RxFinalizeNetFobx(), RxFinalizeNetRoot(), RxFinalizeSrvCall(), RxFinalizeVNetRoot(), RxFreeObject(), RxpDestroySrvCall(), RxRemovePrefixTableEntry(), RxRemoveVirtualNetRootFromNetRoot(), RxScavengeRelatedFobxs(), RxTearDownBufferingManager(), RxUndoScavengerFinalizationMarking() - Implemented RxPostToWorkerThread() - Implemented RxFlushFcbInSystemCache(), RxPurgeFcb(), RxPurgeFcbInSystemCache() - Stubbed RxOrphanSrvOpens(), RxpDiscardChangeBufferingStateRequests(), RxpDispatchChangeBufferingStateRequests(), RxpProcessChangeBufferingStateRequests() - Continued implementation of RxDereference() so that it supports more objects than just SRV_CALL - Reworked RxInsertWorkQueueItem() implementation so that it accepts any work item, and not just dispatch work items - Finished implementation of RxTableLookupName() so that it properly returns a V_NET_ROOT on NET_ROOT match Notable effects of this commit are: - RXCE/RDBSS leak less memory; now objects without references are properly deleted from the system - This means that stale objects are also deleted; this fixes CORE-13483 were same stale SRV_CALL was used again and again - Because in prefix table NET_ROOT are correctly handled, it's now possible to mount several path from the same prefix; this fixes CORE-13482 CORE-8204 CORE-11327 CORE-13482 CORE-13483 Modified: trunk/reactos/sdk/include/ddk/buffring.h trunk/reactos/sdk/include/ddk/fcb.h trunk/reactos/sdk/include/ddk/fcbtable.h trunk/reactos/sdk/include/ddk/mrxfcb.h trunk/reactos/sdk/include/ddk/prefix.h trunk/reactos/sdk/include/ddk/rxprocs.h trunk/reactos/sdk/include/ddk/rxworkq.h trunk/reactos/sdk/lib/drivers/rxce/rxce.c Modified: trunk/reactos/sdk/include/ddk/buffring.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/ddk/buffring.h…
============================================================================== --- trunk/reactos/sdk/include/ddk/buffring.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/ddk/buffring.h [iso-8859-1] Sun Jun 25 11:55:37 2017 @@ -22,6 +22,29 @@ LIST_ENTRY SrvOpenLists[1]; } RX_BUFFERING_MANAGER, *PRX_BUFFERING_MANAGER; +#if (_WIN32_WINNT >= 0x0600) +#define RxAcquireBufferingManagerMutex(BufMan) ExAcquireFastMutex(&(BufMan)->Mutex) +#else +#define RxAcquireBufferingManagerMutex(BufMan) \ + { \ + if (!ExTryToAcquireFastMutex(&(BufMan)->Mutex)) \ + { \ + ExAcquireFastMutex(&(BufMan)->Mutex); \ + } \ + } +#endif +#define RxReleaseBufferingManagerMutex(BufMan) ExReleaseFastMutex(&(BufMan)->Mutex) + +VOID +RxpProcessChangeBufferingStateRequests( + PSRV_CALL SrvCall, + BOOLEAN UpdateHandlerState); + +VOID +NTAPI +RxProcessChangeBufferingStateRequests( + _In_ PVOID SrvCall); + VOID RxProcessFcbChangeBufferingStateRequest( _In_ PFCB Fcb); @@ -39,6 +62,15 @@ _In_ PSRV_CALL SrvCall); NTSTATUS +RxTearDownBufferingManager( + _In_ PSRV_CALL SrvCall); + +NTSTATUS +RxFlushFcbInSystemCache( + _In_ PFCB Fcb, + _In_ BOOLEAN SynchronizeWithLazyWriter); + +NTSTATUS RxPurgeFcbInSystemCache( _In_ PFCB Fcb, _In_ PLARGE_INTEGER FileOffset OPTIONAL, Modified: trunk/reactos/sdk/include/ddk/fcb.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/ddk/fcb.h?rev=…
============================================================================== --- trunk/reactos/sdk/include/ddk/fcb.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/ddk/fcb.h [iso-8859-1] Sun Jun 25 11:55:37 2017 @@ -26,6 +26,9 @@ PURGE_SYNCHRONIZATION_CONTEXT PurgeSyncronizationContext; RX_BUFFERING_MANAGER BufferingManager; } SRV_CALL, *PSRV_CALL; + +#define NETROOT_FLAG_FINALIZATION_IN_PROGRESS 0x00040000 +#define NETROOT_FLAG_NAME_ALREADY_REMOVED 0x00080000 typedef struct _NET_ROOT { @@ -270,6 +273,7 @@ #define FOBX_FLAG_MATCH_ALL 0x10000 #define FOBX_FLAG_FREE_UNICODE 0x20000 #define FOBX_FLAG_DELETE_ON_CLOSE 0x800000 +#define FOBX_FLAG_SRVOPEN_CLOSED 0x1000000 #define FOBX_FLAG_UNC_NAME 0x2000000 #define FOBX_FLAG_ENCLOSED_ALLOCATED 0x4000000 @@ -463,6 +467,12 @@ _In_ PUNICODE_STRING FilePath, _In_ PRX_CONNECTION_ID RxConnectionId); +BOOLEAN +RxFinalizeVNetRoot( + _Out_ PV_NET_ROOT ThisVNetRoot, + _In_ BOOLEAN RecursiveFinalize, + _In_ BOOLEAN ForceFinalize); + #define RxWaitForStableVNetRoot(V, R) RxWaitForStableCondition(&(V)->Condition, &(V)->TransitionWaitList, (R), NULL) #define RxTransitionVNetRoot(V, C) RxUpdateCondition((C), &(V)->Condition, &(V)->TransitionWaitList) @@ -577,6 +587,12 @@ RxCreateNetFobx( _Out_ PRX_CONTEXT RxContext, _In_ PMRX_SRV_OPEN MrxSrvOpen); + +BOOLEAN +RxFinalizeNetFobx( + _Out_ PFOBX ThisFobx, + _In_ BOOLEAN RecursiveFinalize, + _In_ BOOLEAN ForceFinalize); #ifdef __REACTOS__ #define FILL_IN_FCB(Fcb, a, nl, ct, lat, lwt, lct, as, fs, vdl) \ Modified: trunk/reactos/sdk/include/ddk/fcbtable.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/ddk/fcbtable.h…
============================================================================== --- trunk/reactos/sdk/include/ddk/fcbtable.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/ddk/fcbtable.h [iso-8859-1] Sun Jun 25 11:55:37 2017 @@ -32,6 +32,10 @@ _Inout_ PRX_FCB_TABLE FcbTable, _In_ BOOLEAN CaseInsensitiveMatch); +VOID +RxFinalizeFcbTable( + _Inout_ PRX_FCB_TABLE FcbTable); + PFCB RxFcbTableLookupFcb( _In_ PRX_FCB_TABLE FcbTable, Modified: trunk/reactos/sdk/include/ddk/mrxfcb.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/ddk/mrxfcb.h?r…
============================================================================== --- trunk/reactos/sdk/include/ddk/mrxfcb.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/ddk/mrxfcb.h [iso-8859-1] Sun Jun 25 11:55:37 2017 @@ -11,6 +11,7 @@ #define SRVCALL_FLAG_CASE_INSENSITIVE_NETROOTS 0x4 #define SRVCALL_FLAG_CASE_INSENSITIVE_FILENAMES 0x8 #define SRVCALL_FLAG_DFS_AWARE_SERVER 0x10 +#define SRVCALL_FLAG_FORCE_FINALIZED 0x20 typedef struct _MRX_SRV_CALL_ { Modified: trunk/reactos/sdk/include/ddk/prefix.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/ddk/prefix.h?r…
============================================================================== --- trunk/reactos/sdk/include/ddk/prefix.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/ddk/prefix.h [iso-8859-1] Sun Jun 25 11:55:37 2017 @@ -29,6 +29,11 @@ _In_ PULONG ContainerRefCount, _In_ USHORT CaseInsensitiveLength, _In_ PRX_CONNECTION_ID ConnectionId); + +VOID +RxRemovePrefixTableEntry( + _Inout_ PRX_PREFIX_TABLE ThisTable, + _Inout_ PRX_PREFIX_ENTRY Entry); VOID RxInitializePrefixTable( Modified: trunk/reactos/sdk/include/ddk/rxprocs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/ddk/rxprocs.h?…
============================================================================== --- trunk/reactos/sdk/include/ddk/rxprocs.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/ddk/rxprocs.h [iso-8859-1] Sun Jun 25 11:55:37 2017 @@ -528,6 +528,14 @@ RxGetNetworkProviderPriority( _In_ PUNICODE_STRING DeviceName); +VOID +RxpDiscardChangeBufferingStateRequests( + _Inout_ PLIST_ENTRY DiscardedRequests); + +VOID +RxUndoScavengerFinalizationMarking( + PVOID Instance); + ULONG RxTableComputePathHashValue( _In_ PUNICODE_STRING Name); @@ -560,6 +568,11 @@ VOID RxAddVirtualNetRootToNetRoot( + _In_ PNET_ROOT NetRoot, + _In_ PV_NET_ROOT VNetRoot); + +VOID +RxRemoveVirtualNetRootFromNetRoot( _In_ PNET_ROOT NetRoot, _In_ PV_NET_ROOT VNetRoot); @@ -575,6 +588,10 @@ RxFreeFcbObject( _In_ PVOID Object); +VOID +RxPurgeFcb( + _In_ PFCB Fcb); + BOOLEAN RxFinalizeNetFcb( _Out_ PFCB ThisFcb, @@ -642,6 +659,10 @@ _In_opt_ PRX_CONNECTION_ID RxConnectionId); VOID +RxOrphanSrvOpens( + _In_ PV_NET_ROOT ThisVNetRoot); + +VOID RxOrphanThisFcb( _In_ PFCB Fcb); Modified: trunk/reactos/sdk/include/ddk/rxworkq.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/ddk/rxworkq.h?…
============================================================================== --- trunk/reactos/sdk/include/ddk/rxworkq.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/ddk/rxworkq.h [iso-8859-1] Sun Jun 25 11:55:37 2017 @@ -82,6 +82,15 @@ NTSTATUS NTAPI +RxPostToWorkerThread( + _In_ PRDBSS_DEVICE_OBJECT pMRxDeviceObject, + _In_ WORK_QUEUE_TYPE WorkQueueType, + _In_ PRX_WORK_QUEUE_ITEM pWorkQueueItem, + _In_ PRX_WORKERTHREAD_ROUTINE Routine, + _In_ PVOID pContext); + +NTSTATUS +NTAPI RxDispatchToWorkerThread( _In_ PRDBSS_DEVICE_OBJECT pMRxDeviceObject, _In_ WORK_QUEUE_TYPE WorkQueueType, Modified: trunk/reactos/sdk/lib/drivers/rxce/rxce.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/drivers/rxce/rxce.…
============================================================================== --- trunk/reactos/sdk/lib/drivers/rxce/rxce.c [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/drivers/rxce/rxce.c [iso-8859-1] Sun Jun 25 11:55:37 2017 @@ -58,11 +58,22 @@ RxInsertWorkQueueItem( PRDBSS_DEVICE_OBJECT pMRxDeviceObject, WORK_QUEUE_TYPE WorkQueueType, - PRX_WORK_DISPATCH_ITEM DispatchItem); + PRX_WORK_QUEUE_ITEM WorkQueueItem); PVOID RxNewMapUserBuffer( PRX_CONTEXT RxContext); + +VOID +NTAPI +RxpDestroySrvCall( + IN PVOID Context); + +VOID +RxpDispatchChangeBufferingStateRequests( + PSRV_CALL SrvCall, + PSRV_OPEN SrvOpen, + PLIST_ENTRY DiscardedRequests); VOID NTAPI @@ -730,11 +741,71 @@ } } +/* + * @implemented + */ VOID RxCompleteSrvOpenKeyAssociation( IN OUT PSRV_OPEN SrvOpen) { - UNIMPLEMENTED; + PSRV_CALL SrvCall; + + SrvCall = (PSRV_CALL)((PFCB)SrvOpen->pFcb)->VNetRoot->pNetRoot->pSrvCall; + /* Only handle requests if opening was a success */ + if (SrvOpen->Condition == Condition_Good) + { + KIRQL OldIrql; + BOOLEAN ProcessChange; + LIST_ENTRY DiscardedRequests; + + /* Initialize our discarded requests list */ + InitializeListHead(&DiscardedRequests); + + RxAcquireBufferingManagerMutex(&SrvCall->BufferingManager); + + /* Transfer our requests in the SRV_CALL */ + RxTransferList(&SrvCall->BufferingManager.SrvOpenLists[0], &SrvOpen->SrvOpenKeyList); + + /* Was increased in RxInitiateSrvOpenKeyAssociation(), opening is done */ + InterlockedDecrement(&SrvCall->BufferingManager.NumberOfOutstandingOpens); + + /* Dispatch requests and get the discarded ones */ + RxpDispatchChangeBufferingStateRequests(SrvCall, SrvOpen, &DiscardedRequests); + + RxReleaseBufferingManagerMutex(&SrvCall->BufferingManager); + + /* Is there still anything to process? */ + KeAcquireSpinLock(&SrvCall->BufferingManager.SpinLock, &OldIrql); + if (IsListEmpty(&SrvCall->BufferingManager.HandlerList)) + { + ProcessChange = FALSE; + } + else + { + ProcessChange = (SrvCall->BufferingManager.HandlerInactive == FALSE); + if (ProcessChange) + { + SrvCall->BufferingManager.HandlerInactive = TRUE; + } + } + KeReleaseSpinLock(&SrvCall->BufferingManager.SpinLock, OldIrql); + + /* Yes? Go ahead! */ + if (ProcessChange) + { + RxReferenceSrvCall(SrvCall); + RxPostToWorkerThread(RxFileSystemDeviceObject, HyperCriticalWorkQueue, + &SrvCall->BufferingManager.HandlerWorkItem, + RxProcessChangeBufferingStateRequests, SrvCall); + } + + /* And discard left requests */ + RxpDiscardChangeBufferingStateRequests(&DiscardedRequests); + } + else + { + InterlockedDecrement(&SrvCall->BufferingManager.NumberOfOutstandingOpens); + } } /* @@ -1795,7 +1866,7 @@ RxReleaseScavengerMutex(); - /* TODO: Really deallocate stuff - we're leaking as hell! */ + /* Now, deallocate the memory */ switch (NodeType) { case RDBSS_NTC_SRVCALL: @@ -1811,20 +1882,53 @@ } case RDBSS_NTC_NETROOT: - UNIMPLEMENTED; + { + PNET_ROOT NetRoot; + + NetRoot = (PNET_ROOT)Instance; + + ASSERT(NetRoot->pSrvCall->RxDeviceObject != NULL); + ASSERT(RxIsPrefixTableLockAcquired(NetRoot->pSrvCall->RxDeviceObject->pRxNetNameTable)); + RxFinalizeNetRoot(NetRoot, TRUE, TRUE); break; + } case RDBSS_NTC_V_NETROOT: - UNIMPLEMENTED; + { + PV_NET_ROOT VNetRoot; + + VNetRoot = (PV_NET_ROOT)Instance; + + ASSERT(VNetRoot->pNetRoot->pSrvCall->RxDeviceObject != NULL); + ASSERT(RxIsPrefixTableLockAcquired(VNetRoot->pNetRoot->pSrvCall->RxDeviceObject->pRxNetNameTable)); + RxFinalizeVNetRoot(VNetRoot, TRUE, TRUE); break; + } case RDBSS_NTC_SRVOPEN: - UNIMPLEMENTED; + { + PSRV_OPEN SrvOpen; + + SrvOpen = (PSRV_OPEN)Instance; + + ASSERT(RxIsFcbAcquired(SrvOpen->Fcb)); + if (SrvOpen->OpenCount == 0) + { + RxFinalizeSrvOpen(SrvOpen, FALSE, FALSE); + } break; + } case RDBSS_NTC_FOBX: - UNIMPLEMENTED; + { + PFOBX Fobx; + + Fobx = (PFOBX)Instance; + + ASSERT(RxIsFcbAcquired(Fobx->SrvOpen->Fcb)); + RxFinalizeNetFobx(Fobx, TRUE, FALSE); break; + } } } @@ -1938,7 +2042,7 @@ DispatchItem->WorkQueueItem.Parameter = DispatchItem; /* Insert item */ - Status = RxInsertWorkQueueItem(pMRxDeviceObject, WorkQueueType, DispatchItem); + Status = RxInsertWorkQueueItem(pMRxDeviceObject, WorkQueueType, &DispatchItem->WorkQueueItem); if (!NT_SUCCESS(Status)) { RxFreePoolWithTag(DispatchItem, RX_WORKQ_POOLTAG); @@ -2148,6 +2252,27 @@ /* * @implemented */ +VOID +RxFinalizeFcbTable( + IN OUT PRX_FCB_TABLE FcbTable) +{ + USHORT Bucket; + + PAGED_CODE(); + + /* Just delete the lock */ + ExDeleteResourceLite(&FcbTable->TableLock); + + /* And make sure (checked) that the table is really empty... */ + for (Bucket = 0; Bucket < FcbTable->NumberOfBuckets; ++Bucket) + { + ASSERT(IsListEmpty(&FcbTable->HashBuckets[Bucket])); + } +} + +/* + * @implemented + */ BOOLEAN RxFinalizeNetFcb( OUT PFCB ThisFcb, @@ -2277,25 +2402,294 @@ return TRUE; } +/* + * @implemented + */ +BOOLEAN +RxFinalizeNetFobx( + _Out_ PFOBX ThisFobx, + _In_ BOOLEAN RecursiveFinalize, + _In_ BOOLEAN ForceFinalize) +{ + PFCB Fcb; + PSRV_OPEN SrvOpen; + + PAGED_CODE(); + + ASSERT(NodeType(ThisFobx) == RDBSS_NTC_FOBX); + + /* Only finalize if forced or if there's no ref left */ + if (ThisFobx->NodeReferenceCount != 0 && + !ForceFinalize) + { + return FALSE; + } + + DPRINT("Finalize Fobx: %p (with %d ref), forced: %d\n", ThisFobx, ThisFobx->NodeReferenceCount, ForceFinalize); + + SrvOpen = ThisFobx->SrvOpen; + Fcb = SrvOpen->Fcb; + /* If it wasn't finalized yet, do it */ + if (!ThisFobx->UpperFinalizationDone) + { + ASSERT(NodeType(SrvOpen->Fcb) != RDBSS_NTC_OPENTARGETDIR_FCB); + ASSERT(RxIsFcbAcquiredExclusive(SrvOpen->Fcb)); + + /* Remove it from the SRV_OPEN */ + RemoveEntryList(&ThisFobx->FobxQLinks); + + /* If we were used to browse a directory, free the query buffer */ + if (BooleanFlagOn(ThisFobx->Flags, FOBX_FLAG_FREE_UNICODE)) + { + RxFreePoolWithTag(ThisFobx->UnicodeQueryTemplate.Buffer, RX_DIRCTL_POOLTAG); + } + + /* Notify the mini-rdr */ + if (Fcb->MRxDispatch != NULL && Fcb->MRxDispatch->MRxDeallocateForFobx != NULL) + { + Fcb->MRxDispatch->MRxDeallocateForFobx((PMRX_FOBX)ThisFobx); + } + + /* If the SRV_OPEN wasn't closed yet, do it */ + if (!BooleanFlagOn(ThisFobx->Flags, FOBX_FLAG_SRVOPEN_CLOSED)) + { + NTSTATUS Status; + + Status = RxCloseAssociatedSrvOpen(ThisFobx, FALSE); + DPRINT("Closing SRV_OPEN %p for %p: %x\n", SrvOpen, ThisFobx, Status); + } + + /* Finalization done */ + ThisFobx->UpperFinalizationDone = TRUE; + } + + /* If we're still referenced, don't go any further! */ + if (ThisFobx->NodeReferenceCount != 0) + { + return FALSE; + } + + /* At that point, everything should be closed */ + ASSERT(IsListEmpty(&ThisFobx->ClosePendingList)); + + /* Was the FOBX allocated with another object? + * If so, mark the buffer free in said object + */ + if (ThisFobx == Fcb->InternalFobx) + { + ClearFlag(Fcb->FcbState, FCB_STATE_FOBX_USED); + } + else if (ThisFobx == SrvOpen->InternalFobx) + { + ClearFlag(SrvOpen->Flags, SRVOPEN_FLAG_FOBX_USED); + } + + ThisFobx->pSrvOpen = NULL; + + /* A FOBX less */ + InterlockedDecrement((volatile long *)&SrvOpen->pVNetRoot->NumberOfFobxs); + + RxDereferenceSrvOpen(SrvOpen, LHS_ExclusiveLockHeld); + + /* If it wasn't allocated with another object, free the FOBX */ + if (!BooleanFlagOn(ThisFobx->Flags, FOBX_FLAG_ENCLOSED_ALLOCATED)) + { + RxFreeFcbObject(ThisFobx); + } + + return TRUE; +} + +/* + * @implemented + */ BOOLEAN RxFinalizeNetRoot( OUT PNET_ROOT ThisNetRoot, IN BOOLEAN RecursiveFinalize, - IN BOOLEAN ForceFinalize - ) -{ - UNIMPLEMENTED; - return FALSE; -} - + IN BOOLEAN ForceFinalize) +{ + PSRV_CALL SrvCall; + PRX_FCB_TABLE FcbTable; + PRX_PREFIX_TABLE PrefixTable; + + PAGED_CODE(); + + ASSERT(NodeType(ThisNetRoot) == RDBSS_NTC_NETROOT); + + PrefixTable = ThisNetRoot->pSrvCall->RxDeviceObject->pRxNetNameTable; + ASSERT(RxIsPrefixTableLockAcquired(PrefixTable)); + + /* If sme finalization is already ongoing, leave */ + if (BooleanFlagOn(ThisNetRoot->Flags, NETROOT_FLAG_FINALIZATION_IN_PROGRESS)) + { + return FALSE; + } + + /* Mark we're finalizing */ + SetFlag(ThisNetRoot->Flags, NETROOT_FLAG_FINALIZATION_IN_PROGRESS); + + FcbTable = &ThisNetRoot->FcbTable; + /* Did caller asked us to finalize any associated FCB? */ + if (RecursiveFinalize) + { + USHORT Bucket; + + /* Browse all the FCBs in our FCB table */ + RxAcquireFcbTableLockExclusive(FcbTable, TRUE); + for (Bucket = 0; Bucket < FcbTable->NumberOfBuckets; ++Bucket) + { + PLIST_ENTRY HashBucket, ListEntry; + + HashBucket = &FcbTable->HashBuckets[Bucket]; + ListEntry = HashBucket->Flink; + while (ListEntry != HashBucket) + { + PFCB Fcb; + + Fcb = CONTAINING_RECORD(ListEntry, FCB, FcbTableEntry.HashLinks); + ASSERT(NodeTypeIsFcb(Fcb)); + + ListEntry = ListEntry->Flink; + + /* If the FCB isn't orphaned, then, it's time to purge it */ + if (!BooleanFlagOn(Fcb->FcbState, FCB_STATE_ORPHANED)) + { + NTSTATUS Status; + + Status = RxAcquireExclusiveFcb(NULL, Fcb); + ASSERT(Status == STATUS_SUCCESS); + RxPurgeFcb(Fcb); + } + } + } + RxReleaseFcbTableLock(FcbTable); + } + + /* Only finalize if forced or if there's a single ref left */ + if (ThisNetRoot->NodeReferenceCount != 1 && !ForceFinalize) + { + return FALSE; + } + + DPRINT("Finalizing NetRoot %p for %wZ\n", ThisNetRoot, &ThisNetRoot->PrefixEntry.Prefix); + + /* If we're still referenced, don't go any further! */ + if (ThisNetRoot->NodeReferenceCount != 1) + { + return FALSE; + } + + /* Finalize the FCB table (and make sure it's empty!) */ + RxFinalizeFcbTable(FcbTable); + + /* If name wasn't remove already, do it now */ + if (!BooleanFlagOn(ThisNetRoot->Flags, NETROOT_FLAG_NAME_ALREADY_REMOVED)) + { + RxRemovePrefixTableEntry(PrefixTable, &ThisNetRoot->PrefixEntry); + } + + /* Delete the object */ + SrvCall = (PSRV_CALL)ThisNetRoot->pSrvCall; + RxFreeObject(ThisNetRoot); + + /* And dereference the associated SRV_CALL */ + if (SrvCall != NULL) + { + RxDereferenceSrvCall(SrvCall, LHS_ExclusiveLockHeld); + } + + return TRUE; +} + +/* + * @implemented + */ BOOLEAN RxFinalizeSrvCall( OUT PSRV_CALL ThisSrvCall, IN BOOLEAN RecursiveFinalize, IN BOOLEAN ForceFinalize) { - UNIMPLEMENTED; - return FALSE; + PRX_PREFIX_TABLE PrefixTable; + + PAGED_CODE(); + + ASSERT(NodeType(ThisSrvCall) == RDBSS_NTC_SRVCALL); + + PrefixTable = ThisSrvCall->RxDeviceObject->pRxNetNameTable; + ASSERT(RxIsPrefixTableLockAcquired(PrefixTable)); + + /* Only finalize if forced or if there's a single ref left */ + if (ThisSrvCall->NodeReferenceCount != 1 && + !ForceFinalize) + { + return FALSE; + } + + DPRINT("Finalizing SrvCall %p for %wZ\n", ThisSrvCall, &ThisSrvCall->PrefixEntry.Prefix); + + /* If it wasn't finalized yet, do it */ + if (!ThisSrvCall->UpperFinalizationDone) + { + BOOLEAN WillFree; + + /* Remove ourselves from prefix table */ + RxRemovePrefixTableEntry(PrefixTable, &ThisSrvCall->PrefixEntry); + + /* Remember our third arg, in case we get queued for later execution */ + if (ForceFinalize) + { + SetFlag(ThisSrvCall->Flags, SRVCALL_FLAG_FORCE_FINALIZED); + } + + /* And done */ + ThisSrvCall->UpperFinalizationDone = TRUE; + + /* Would defered execution free the object? */ + WillFree = (ThisSrvCall->NodeReferenceCount == 1); + + /* If we have a device object */ + if (ThisSrvCall->RxDeviceObject != NULL) + { + NTSTATUS Status; + + /* If we're not executing in the RDBSS thread, queue for execution within the thread */ + if (RxGetRDBSSProcess() != IoGetCurrentProcess()) + { + /* Extra ref, as usual */ + InterlockedIncrement((volatile long *)&ThisSrvCall->NodeReferenceCount); + /* And dispatch */ + RxDispatchToWorkerThread(ThisSrvCall->RxDeviceObject, DelayedWorkQueue, RxpDestroySrvCall, ThisSrvCall); + + /* Return to the caller, in advance, whether we're freeing the object or not */ + return WillFree; + } + + /* If in the right thread already, call the mini-rdr */ + MINIRDR_CALL_THROUGH(Status, ThisSrvCall->RxDeviceObject->Dispatch, + MRxFinalizeSrvCall, ((PMRX_SRV_CALL)ThisSrvCall, ForceFinalize)); + (void)Status; + } + } + + /* If we're still referenced, don't go any further! */ + if (ThisSrvCall->NodeReferenceCount != 1) + { + return FALSE; + } + + /* Don't leak */ + if (ThisSrvCall->pDomainName != NULL) + { + RxFreePool(ThisSrvCall->pDomainName); + } + + /* And free! */ + RxTearDownBufferingManager(ThisSrvCall); + RxFreeObject(ThisSrvCall); + + return TRUE; } BOOLEAN @@ -2306,6 +2700,83 @@ { UNIMPLEMENTED; return FALSE; +} + +/* + * @implemented + */ +BOOLEAN +RxFinalizeVNetRoot( + OUT PV_NET_ROOT ThisVNetRoot, + IN BOOLEAN RecursiveFinalize, + IN BOOLEAN ForceFinalize) +{ + PNET_ROOT NetRoot; + PRX_PREFIX_TABLE PrefixTable; + + PAGED_CODE(); + + ASSERT(NodeType(ThisVNetRoot) == RDBSS_NTC_V_NETROOT); + + PrefixTable = ThisVNetRoot->pNetRoot->pSrvCall->RxDeviceObject->pRxNetNameTable; + ASSERT(RxIsPrefixTableLockAcquired(PrefixTable)); + + /* Only finalize if forced or if there's a single ref left */ + if (ThisVNetRoot->NodeReferenceCount != 1 && + !ForceFinalize) + { + return FALSE; + } + + DPRINT("Finalizing VNetRoot %p for %wZ\n", ThisVNetRoot, &ThisVNetRoot->PrefixEntry.Prefix); + + NetRoot = (PNET_ROOT)ThisVNetRoot->pNetRoot; + /* If it wasn't finalized yet, do it */ + if (!ThisVNetRoot->UpperFinalizationDone) + { + ASSERT(NodeType(NetRoot) == RDBSS_NTC_NETROOT); + + /* Reference the NetRoot so that it doesn't disappear */ + RxReferenceNetRoot(NetRoot); + RxOrphanSrvOpens(ThisVNetRoot); + /* Remove us from the available VNetRoot for NetRoot */ + RxRemoveVirtualNetRootFromNetRoot(NetRoot, ThisVNetRoot); + /* Remove extra ref */ + RxDereferenceNetRoot(NetRoot, LHS_ExclusiveLockHeld); + + /* Remove ourselves from prefix table */ + RxRemovePrefixTableEntry(PrefixTable, &ThisVNetRoot->PrefixEntry); + + /* Finalization done */ + ThisVNetRoot->UpperFinalizationDone = TRUE; + } + + /* If we're still referenced, don't go any further! */ + if (ThisVNetRoot->NodeReferenceCount != 1) + { + return FALSE; + } + + /* If there's an associated device, notify mini-rdr */ + if (NetRoot->pSrvCall->RxDeviceObject != NULL) + { + NTSTATUS Status; + + MINIRDR_CALL_THROUGH(Status, NetRoot->pSrvCall->RxDeviceObject->Dispatch, + MRxFinalizeVNetRoot, ((PMRX_V_NET_ROOT)ThisVNetRoot, FALSE)); + (void)Status; + } + + /* Free parameters */ + RxUninitializeVNetRootParameters(ThisVNetRoot->pUserName, ThisVNetRoot->pUserDomainName, + ThisVNetRoot->pPassword, &ThisVNetRoot->Flags); + /* Dereference our NetRoot, we won't reference it anymore */ + RxDereferenceNetRoot(NetRoot, LHS_ExclusiveLockHeld); + + /* And free the object! */ + RxFreePoolWithTag(ThisVNetRoot, RX_V_NETROOT_POOLTAG); + + return TRUE; } NTSTATUS @@ -3109,6 +3580,31 @@ } } +/* + * @implemented + */ +NTSTATUS +RxFlushFcbInSystemCache( + IN PFCB Fcb, + IN BOOLEAN SynchronizeWithLazyWriter) +{ + IO_STATUS_BLOCK IoStatus; + + PAGED_CODE(); + + /* Deal with Cc */ + CcFlushCache(&Fcb->NonPaged->SectionObjectPointers, NULL, 0, &IoStatus); + /* If we're asked to sync with LW, do it in case of success */ + if (SynchronizeWithLazyWriter && NT_SUCCESS(IoStatus.Status)) + { + RxAcquirePagingIoResource((PRX_CONTEXT)NULL, Fcb); + RxReleasePagingIoResource((PRX_CONTEXT)NULL, Fcb); + } + + DPRINT("Flushing for FCB %p returns %lx\n", Fcb, IoStatus.Status); + return IoStatus.Status; +} + VOID RxFreeFcbObject( PVOID Object) @@ -3116,11 +3612,46 @@ UNIMPLEMENTED; } +/* + * @implemented + */ VOID RxFreeObject( PVOID pObject) { - UNIMPLEMENTED; + PAGED_CODE(); + + /* First, perform a few sanity checks if we're dealing with a SRV_CALL or a NET_ROOT */ + if (NodeType(pObject) == RDBSS_NTC_SRVCALL) + { + PSRV_CALL SrvCall; + PRDBSS_DEVICE_OBJECT DeviceObject; + + SrvCall = (PSRV_CALL)pObject; + DeviceObject = SrvCall->RxDeviceObject; + if (DeviceObject != NULL) + { + if (!BooleanFlagOn(DeviceObject->Dispatch->MRxFlags, RDBSS_MANAGE_SRV_CALL_EXTENSION)) + { + ASSERT(SrvCall->Context == NULL); + } + + ASSERT(SrvCall->Context2 == NULL); + + SrvCall->RxDeviceObject = NULL; + } + } + else if (NodeType(pObject) == RDBSS_NTC_NETROOT) + { + PNET_ROOT NetRoot; + + NetRoot = (PNET_ROOT)pObject; + NetRoot->pSrvCall = NULL; + NetRoot->NodeTypeCode = NodeType(pObject) | 0xF000; + } + + /* And just free the object */ + RxFreePool(pObject); } /* @@ -3749,12 +4280,24 @@ return Status; } -VOID -RxInitiateSrvOpenKeyAssociation ( - IN OUT PSRV_OPEN SrvOpen - ) -{ - UNIMPLEMENTED; +/* + * @implemented + */ +VOID +RxInitiateSrvOpenKeyAssociation( + IN OUT PSRV_OPEN SrvOpen) +{ + PRX_BUFFERING_MANAGER BufferingManager; + + PAGED_CODE(); + + SrvOpen->Key = NULL; + + /* Just keep track of the opening request */ + BufferingManager = &((PSRV_CALL)((PFCB)SrvOpen->pFcb)->VNetRoot->pNetRoot->pSrvCall)->BufferingManager; + InterlockedIncrement(&BufferingManager->NumberOfOutstandingOpens); + + InitializeListHead(&SrvOpen->SrvOpenKeyList); } /* @@ -3764,7 +4307,7 @@ RxInsertWorkQueueItem( PRDBSS_DEVICE_OBJECT pMRxDeviceObject, WORK_QUEUE_TYPE WorkQueueType, - PRX_WORK_DISPATCH_ITEM DispatchItem) + PRX_WORK_QUEUE_ITEM WorkQueueItem) { KIRQL OldIrql; NTSTATUS Status; @@ -3789,7 +4332,7 @@ else { SpinUpThreads = FALSE; - DispatchItem->WorkQueueItem.pDeviceObject = pMRxDeviceObject; + WorkQueueItem->pDeviceObject = pMRxDeviceObject; InterlockedIncrement(&pMRxDeviceObject->DispatcherContext.NumberOfWorkerThreads); WorkQueue->CumulativeQueueLength += WorkQueue->NumberOfWorkItemsToBeDispatched; InterlockedIncrement(&WorkQueue->NumberOfWorkItemsToBeDispatched); @@ -3814,7 +4357,7 @@ } /* All fine, insert the item */ - KeInsertQueue(&WorkQueue->Queue, &DispatchItem->WorkQueueItem.List); + KeInsertQueue(&WorkQueue->Queue, &WorkQueueItem->List); /* And start a new worker thread if needed */ if (SpinUpThreads) @@ -3833,7 +4376,7 @@ CscAgent = FALSE; - /* Client Side Caching is DFS stuff - we don't support it */ + /* Client Side Caching is DFS stuff - we don't support it */ if (RxContext->Create.EaLength != 0) { UNIMPLEMENTED; @@ -4279,6 +4822,13 @@ UNIMPLEMENTED; } +VOID +RxOrphanSrvOpens( + IN PV_NET_ROOT ThisVNetRoot) +{ + UNIMPLEMENTED; +} + /* * @implemented */ @@ -4418,6 +4968,86 @@ PRINT_REF_COUNT(NETFCB, NewCount); return NewCount; +} + +/* + * @implemented + */ +VOID +NTAPI +RxpDestroySrvCall( + IN PVOID Context) +{ + NTSTATUS Status; + PSRV_CALL SrvCall; + BOOLEAN ForceFinalize; + PRX_PREFIX_TABLE PrefixTable; + + SrvCall = (PSRV_CALL)Context; + /* At this step, RxFinalizeSrvCall already cleaned some fields */ + ASSERT(SrvCall->UpperFinalizationDone); + + PrefixTable = SrvCall->RxDeviceObject->pRxNetNameTable; + /* Were we called with ForceFinalize? */ + ForceFinalize = BooleanFlagOn(SrvCall->Flags, SRVCALL_FLAG_FORCE_FINALIZED); + + /* Notify mini-rdr */ + MINIRDR_CALL_THROUGH(Status, SrvCall->RxDeviceObject->Dispatch, + MRxFinalizeSrvCall, ((PMRX_SRV_CALL)SrvCall, + ForceFinalize)); + (void)Status; + + /* Dereference our extra reference (set before queueing) */ + RxAcquirePrefixTableLockExclusive(PrefixTable, TRUE); + InterlockedDecrement((volatile long *)&SrvCall->NodeReferenceCount); + /* And finalize for real, with the right context */ + RxFinalizeSrvCall(SrvCall, FALSE, ForceFinalize); + RxReleasePrefixTableLock(PrefixTable); +} + +VOID +RxpDiscardChangeBufferingStateRequests( + _Inout_ PLIST_ENTRY DiscardedRequests) +{ + UNIMPLEMENTED; +} + +VOID +RxpDispatchChangeBufferingStateRequests( + PSRV_CALL SrvCall, + PSRV_OPEN SrvOpen, + PLIST_ENTRY DiscardedRequests) +{ + UNIMPLEMENTED; +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +RxPostToWorkerThread( + _In_ PRDBSS_DEVICE_OBJECT pMRxDeviceObject, + _In_ WORK_QUEUE_TYPE WorkQueueType, + _In_ PRX_WORK_QUEUE_ITEM pWorkQueueItem, + _In_ PRX_WORKERTHREAD_ROUTINE Routine, + _In_ PVOID pContext) +{ + /* Initialize work queue item */ + pWorkQueueItem->List.Flink = NULL; + pWorkQueueItem->WorkerRoutine = Routine; + pWorkQueueItem->Parameter = pContext; + + /* And insert it in the work queue */ + return RxInsertWorkQueueItem(pMRxDeviceObject, WorkQueueType, pWorkQueueItem); +} + +VOID +RxpProcessChangeBufferingStateRequests( + PSRV_CALL SrvCall, + BOOLEAN UpdateHandlerState) +{ + UNIMPLEMENTED; } /* @@ -4597,6 +5227,19 @@ RxContext->ReferenceCount = 0; } +/* + * @implemented + */ +VOID +NTAPI +RxProcessChangeBufferingStateRequests( + _In_ PVOID SrvCall) +{ + /* Call internal routine */ + RxUndoScavengerFinalizationMarking(SrvCall); + RxpProcessChangeBufferingStateRequests(SrvCall, TRUE); +} + VOID RxProcessFcbChangeBufferingStateRequest( PFCB Fcb) @@ -4655,6 +5298,35 @@ UNIMPLEMENTED; } +/* + * @implemented + */ +VOID +RxPurgeFcb( + IN PFCB Fcb) +{ + PAGED_CODE(); + + ASSERT(RxIsFcbAcquiredExclusive(Fcb)); + + /* Reference our FCB so that it doesn't disappear */ + RxReferenceNetFcb(Fcb); + /* Purge Cc if required */ + if (Fcb->OpenCount != 0) + { + RxPurgeFcbInSystemCache(Fcb, NULL, 0, TRUE, TRUE); + } + + /* If it wasn't freed, release the lock */ + if (!RxDereferenceAndFinalizeNetFcb(Fcb, NULL, FALSE, FALSE)) + { + RxReleaseFcb(NULL, Fcb); + } +} + +/* + * @implemented + */ NTSTATUS RxPurgeFcbInSystemCache( IN PFCB Fcb, @@ -4663,8 +5335,46 @@ IN BOOLEAN UninitializeCacheMaps, IN BOOLEAN FlushFile) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + BOOLEAN Purged; + NTSTATUS Status; + + PAGED_CODE(); + + ASSERT(RxIsFcbAcquiredExclusive(Fcb)); + + /* Try to flush first, if asked */ + if (FlushFile) + { + /* If flushing failed, just make some noise */ + Status = RxFlushFcbInSystemCache(Fcb, TRUE); + if (!NT_SUCCESS(Status)) + { + PVOID CallersAddress, CallersCaller; + + RtlGetCallersAddress(&CallersAddress, &CallersCaller); + DPRINT1("Flush failed with status %lx for FCB %p\n", Status, Fcb); + DPRINT1("Caller was %p %p\n", CallersAddress, CallersCaller); + } + } + + /* Deal with Cc for purge */ + Purged = CcPurgeCacheSection(&Fcb->NonPaged->SectionObjectPointers, FileOffset, + Length, UninitializeCacheMaps); + /* If purge failed, force section closing */ + if (!Purged) + { + MmFlushImageSection(&Fcb->NonPaged->SectionObjectPointers, MmFlushForWrite); + + RxReleaseFcb(NULL, Fcb); + Purged = MmForceSectionClosed(&Fcb->NonPaged->SectionObjectPointers, TRUE); + RxAcquireExclusiveFcb(NULL, Fcb); + } + + /* Return appropriate status */ + Status = (Purged ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL); + DPRINT("Purge for FCB %p returns %lx\n", Fcb, Status); + + return Status; } /* @@ -4877,6 +5587,95 @@ RxReleaseScavengerMutex(); } +/* + * @implemented + */ +VOID +RxRemovePrefixTableEntry( + IN OUT PRX_PREFIX_TABLE ThisTable, + IN OUT PRX_PREFIX_ENTRY Entry) +{ + PAGED_CODE(); + + ASSERT(NodeType(Entry) == RDBSS_NTC_PREFIX_ENTRY); + ASSERT(RxIsPrefixTableLockExclusive(ThisTable)); + + /* Check whether we're asked to remove null entry */ + if (Entry->Prefix.Length == 0) + { + ThisTable->TableEntryForNull = NULL; + } + else + { + RemoveEntryList(&Entry->HashLinks); + } + + Entry->ContainingRecord = NULL; + + /* Also remove it from global list */ + RemoveEntryList(&Entry->MemberQLinks); + + ++ThisTable->Version; +} + +/* + * @implemented + */ +VOID +RxRemoveVirtualNetRootFromNetRoot( + PNET_ROOT NetRoot, + PV_NET_ROOT VNetRoot) +{ + PRX_PREFIX_TABLE PrefixTable; + + PAGED_CODE(); + + PrefixTable = NetRoot->pSrvCall->RxDeviceObject->pRxNetNameTable; + ASSERT(RxIsPrefixTableLockAcquired(PrefixTable)); + + /* Remove the VNetRoot from the list in the NetRoot */ + --NetRoot->NumberOfVirtualNetRoots; + RemoveEntryList(&VNetRoot->NetRootListEntry); + + /* Fix the NetRoot if we were the default VNetRoot */ + if (NetRoot->DefaultVNetRoot == VNetRoot) + { + /* Put the first one available */ + if (!IsListEmpty(&NetRoot->VirtualNetRoots)) + { + NetRoot->DefaultVNetRoot = CONTAINING_RECORD(NetRoot->VirtualNetRoots.Flink, V_NET_ROOT, NetRootListEntry); + } + /* Otherwise, none */ + else + { + NetRoot->DefaultVNetRoot = NULL; + } + } + + /* If there are still other VNetRoot available, we're done */ + if (!IsListEmpty(&NetRoot->VirtualNetRoots)) + { + return; + } + + /* Otherwise, initiate NetRoot finalization */ + if (!BooleanFlagOn(NetRoot->Flags, NETROOT_FLAG_NAME_ALREADY_REMOVED)) + { + RxRemovePrefixTableEntry(PrefixTable, &NetRoot->PrefixEntry); + SetFlag(NetRoot->Flags, NETROOT_FLAG_NAME_ALREADY_REMOVED); + } + + /* Notify mini-rdr */ + if (NetRoot->pSrvCall != NULL && NetRoot->pSrvCall->RxDeviceObject != NULL) + { + NTSTATUS Status; + + MINIRDR_CALL_THROUGH(Status, NetRoot->pSrvCall->RxDeviceObject->Dispatch, + MRxFinalizeNetRoot, ((PMRX_NET_ROOT)NetRoot, FALSE)); + (void)Status; + } +} + VOID NTAPI RxResumeBlockedOperations_Serially( @@ -4899,12 +5698,73 @@ RxReleaseSerializationMutex(); } +/* + * @implemented + */ BOOLEAN RxScavengeRelatedFobxs( PFCB Fcb) { - UNIMPLEMENTED; - return FALSE; + PFOBX Fobx; + LIST_ENTRY LocalList; + PLIST_ENTRY NextEntry; + PRDBSS_SCAVENGER Scavenger; + + PAGED_CODE(); + + /* First of all, check whether there are FOBX to scavenge */ + Scavenger = Fcb->RxDeviceObject->pRdbssScavenger; + RxAcquireScavengerMutex(); + if (Scavenger->FobxsToBeFinalized <= 0) + { + RxReleaseScavengerMutex(); + return FALSE; + } + + /* Initialize our local list which will hold all the FOBX to scavenge so + * that we don't acquire the scavenger mutex too long + */ + InitializeListHead(&LocalList); + + /* Technically, that condition should all be true... */ + if (!IsListEmpty(&Scavenger->FobxFinalizationList)) + { + PLIST_ENTRY NextEntry, LastEntry; + + /* Browse all the FCBs to find the matching ones */ + NextEntry = Scavenger->FobxFinalizationList.Flink; + LastEntry = &Scavenger->FobxFinalizationList; + while (NextEntry != LastEntry) + { + Fobx = CONTAINING_RECORD(NextEntry, FOBX, ScavengerFinalizationList); + NextEntry = NextEntry->Flink; + /* Matching our FCB? Let's finalize it */ + if (Fobx->pSrvOpen != NULL && Fobx->pSrvOpen->pFcb == RX_GET_MRX_FCB(Fcb)) + { + RxpUndoScavengerFinalizationMarking(Fobx); + ASSERT(NodeType(Fobx) == RDBSS_NTC_FOBX); + InsertTailList(&LocalList, &Fobx->ScavengerFinalizationList); + } + } + } + + RxReleaseScavengerMutex(); + + /* Nothing to scavenge? Quit */ + if (IsListEmpty(&LocalList)) + { + return FALSE; + } + + /* Now, finalize all the extracted FOBX */ + while (!IsListEmpty(&LocalList)) + { + NextEntry = RemoveHeadList(&LocalList); + Fobx = CONTAINING_RECORD(NextEntry, FOBX, ScavengerFinalizationList); + RxFinalizeNetFobx(Fobx, TRUE, TRUE); + } + + return TRUE; } BOOLEAN @@ -4965,7 +5825,7 @@ InterlockedDecrement(&WorkQueue->WorkQueueItemForSpinUpWorkerThreadInUse); - DPRINT1("WORKQ:SR %lx %lx\n", WorkItem->WorkerRoutine, WorkItem->Parameter); + DPRINT("Workqueue: calling %p(%p)\n", WorkItem->WorkerRoutine, WorkItem->Parameter); WorkItem->WorkerRoutine(WorkItem->Parameter); } } while (RxDispatcher->State == RxDispatcherActive); @@ -5129,6 +5989,9 @@ return Hash; } +/* + * @implemented + */ PVOID RxTableLookupName( IN PRX_PREFIX_TABLE ThisTable, @@ -5191,10 +6054,34 @@ ASSERT(Entry->ContainingRecord != NULL); Container = Entry->ContainingRecord; - /* Need to handle NetRoot specific case... */ + /* If we have a NET_ROOT, let's return a V_NET_ROOT */ if ((NodeType(Entry->ContainingRecord) & ~RX_SCAVENGER_MASK) == RDBSS_NTC_NETROOT) { - UNIMPLEMENTED; + PNET_ROOT NetRoot; + + NetRoot = (PNET_ROOT)Entry->ContainingRecord; + /* If there's a default one, perfect, that's a match */ + if (NetRoot->DefaultVNetRoot != NULL) + { + Container = NetRoot->DefaultVNetRoot; + } + /* If none (that shouldn't happen!), try to find one */ + else + { + /* Use the first one in the list */ + if (!IsListEmpty(&NetRoot->VirtualNetRoots)) + { + Container = CONTAINING_RECORD(NetRoot->VirtualNetRoots.Flink, V_NET_ROOT, NetRootListEntry); + } + /* Really, really, shouldn't happen */ + else + { + ASSERT(FALSE); + Entry = NULL; + Container = NULL; + } + } + break; } else if ((NodeType(Entry->ContainingRecord) & ~RX_SCAVENGER_MASK) == RDBSS_NTC_V_NETROOT) @@ -5337,6 +6224,19 @@ /* * @implemented */ +NTSTATUS +RxTearDownBufferingManager( + PSRV_CALL SrvCall) +{ + PAGED_CODE(); + + /* Nothing to do */ + return STATUS_SUCCESS; +} + +/* + * @implemented + */ VOID RxTrackerUpdateHistory( _Inout_opt_ PRX_CONTEXT RxContext, @@ -5424,6 +6324,19 @@ _In_ PCSTR File) { UNIMPLEMENTED; +} + +/* + * @implemented + */ +VOID +RxUndoScavengerFinalizationMarking( + PVOID Instance) +{ + /* Just call internal routine with mutex held */ + RxAcquireScavengerMutex(); + RxpUndoScavengerFinalizationMarking(Instance); + RxReleaseScavengerMutex(); } /*
7 years, 6 months
1
0
0
0
[tfaber] 75194: [USBPORT] - Fix setting the direction in USBPORT_OpenPipe. Patch by Vadim Galyant.
by tfaber@svn.reactos.org
Author: tfaber Date: Sun Jun 25 08:17:33 2017 New Revision: 75194 URL:
http://svn.reactos.org/svn/reactos?rev=75194&view=rev
Log: [USBPORT] - Fix setting the direction in USBPORT_OpenPipe. Patch by Vadim Galyant. Modified: trunk/reactos/drivers/usb/usbport/endpoint.c Modified: trunk/reactos/drivers/usb/usbport/endpoint.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbport/endpoi…
============================================================================== --- trunk/reactos/drivers/usb/usbport/endpoint.c [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbport/endpoint.c [iso-8859-1] Sun Jun 25 08:17:33 2017 @@ -796,7 +796,7 @@ goto ExitWithError; } - Direction = USB_ENDPOINT_DIRECTION_IN(EndpointDescriptor->bEndpointAddress); + Direction = USB_ENDPOINT_DIRECTION_OUT(EndpointDescriptor->bEndpointAddress); EndpointProperties->Direction = Direction; if (DeviceHandle->IsRootHub)
7 years, 6 months
1
0
0
0
[tthompson] 75193: [NTFS] - Fix creation of files with long filenames.
by tthompson@svn.reactos.org
Author: tthompson Date: Sun Jun 25 04:29:04 2017 New Revision: 75193 URL:
http://svn.reactos.org/svn/reactos?rev=75193&view=rev
Log: [NTFS] - Fix creation of files with long filenames. Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/attrib.c Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/attrib.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyst…
============================================================================== --- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/attrib.c [iso-8859-1] (original) +++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/attrib.c [iso-8859-1] Sun Jun 25 04:29:04 2017 @@ -220,9 +220,15 @@ DPRINT1("FileNameAttribute->DirectoryFileReferenceNumber: 0x%016I64x\n", FileNameAttribute->DirectoryFileReferenceNumber); FileNameAttribute->NameLength = FilenameNoPath.Length / sizeof(WCHAR); - // TODO: Get proper nametype, add DOS links as needed - FileNameAttribute->NameType = NTFS_FILE_NAME_WIN32_AND_DOS; RtlCopyMemory(FileNameAttribute->Name, FilenameNoPath.Buffer, FilenameNoPath.Length); + + // For now, we're emulating the way Windows behaves when 8.3 name generation is disabled + // TODO: add DOS Filename as needed + if (RtlIsNameLegalDOS8Dot3(&FilenameNoPath, NULL, NULL)) + FileNameAttribute->NameType = NTFS_FILE_NAME_WIN32_AND_DOS; + else + FileNameAttribute->NameType = NTFS_FILE_NAME_POSIX; + FileRecord->LinkCount++; AttributeAddress->Length = ResidentHeaderLength +
7 years, 6 months
1
0
0
0
[tthompson] 75192: [NTFS] - In the NtfsAddFilenameToDirectory() function, rename DirectoryContext parameter to the more descriptive, and accurate, IndexRootContext (to simplify the next commit).
by tthompson@svn.reactos.org
Author: tthompson Date: Sun Jun 25 02:56:40 2017 New Revision: 75192 URL:
http://svn.reactos.org/svn/reactos?rev=75192&view=rev
Log: [NTFS] - In the NtfsAddFilenameToDirectory() function, rename DirectoryContext parameter to the more descriptive, and accurate, IndexRootContext (to simplify the next commit). Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/dirctl.c Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/dirctl.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyst…
============================================================================== --- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/dirctl.c [iso-8859-1] (original) +++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/dirctl.c [iso-8859-1] Sun Jun 25 02:56:40 2017 @@ -72,7 +72,7 @@ { NTSTATUS Status = STATUS_SUCCESS; PFILE_RECORD_HEADER ParentFileRecord; - PNTFS_ATTR_CONTEXT DirectoryContext; + PNTFS_ATTR_CONTEXT IndexRootContext; PINDEX_ROOT_ATTRIBUTE I30IndexRoot; ULONG IndexRootOffset; ULONGLONG I30IndexRootLength; @@ -112,7 +112,7 @@ AttributeIndexRoot, L"$I30", 4, - &DirectoryContext, + &IndexRootContext, &IndexRootOffset); if (!NT_SUCCESS(Status)) { @@ -122,23 +122,23 @@ return Status; } - I30IndexRootLength = AttributeDataLength(&DirectoryContext->Record); + I30IndexRootLength = AttributeDataLength(&IndexRootContext->Record); // Allocate memory for the index root data I30IndexRoot = (PINDEX_ROOT_ATTRIBUTE)ExAllocatePoolWithTag(NonPagedPool, I30IndexRootLength, TAG_NTFS); if (!I30IndexRoot) { DPRINT1("ERROR: Couldn't allocate memory for index root attribute!\n"); - ReleaseAttributeContext(DirectoryContext); + ReleaseAttributeContext(IndexRootContext); ExFreePoolWithTag(ParentFileRecord, TAG_NTFS); } // Read the Index Root - Status = ReadAttribute(DeviceExt, DirectoryContext, 0, (PCHAR)I30IndexRoot, I30IndexRootLength); + Status = ReadAttribute(DeviceExt, IndexRootContext, 0, (PCHAR)I30IndexRoot, I30IndexRootLength); if (!NT_SUCCESS(Status)) { DPRINT1("ERROR: Couln't read index root attribute for Mft index #%I64u\n", DirectoryMftIndex); - ReleaseAttributeContext(DirectoryContext); + ReleaseAttributeContext(IndexRootContext); ExFreePoolWithTag(I30IndexRoot, TAG_NTFS); ExFreePoolWithTag(ParentFileRecord, TAG_NTFS); return Status; @@ -149,7 +149,7 @@ if (IndexNodeEntry->Data.Directory.IndexedFile != 0 || IndexNodeEntry->Flags != 2) { DPRINT1("FIXME: File-creation is only supported in empty directories right now! Be patient! :)\n"); - ReleaseAttributeContext(DirectoryContext); + ReleaseAttributeContext(IndexRootContext); ExFreePoolWithTag(I30IndexRoot, TAG_NTFS); ExFreePoolWithTag(ParentFileRecord, TAG_NTFS); return STATUS_NOT_IMPLEMENTED; @@ -160,7 +160,7 @@ if (!NewIndexRoot) { DPRINT1("ERROR: Unable to allocate memory for new index root attribute!\n"); - ReleaseAttributeContext(DirectoryContext); + ReleaseAttributeContext(IndexRootContext); ExFreePoolWithTag(I30IndexRoot, TAG_NTFS); ExFreePoolWithTag(ParentFileRecord, TAG_NTFS); return STATUS_INSUFFICIENT_RESOURCES; @@ -225,14 +225,14 @@ { DPRINT1("FIXME: For now, only resizing index root at the end of a file record is supported!\n"); ExFreePoolWithTag(NewIndexRoot, TAG_NTFS); - ReleaseAttributeContext(DirectoryContext); + ReleaseAttributeContext(IndexRootContext); ExFreePoolWithTag(I30IndexRoot, TAG_NTFS); ExFreePoolWithTag(ParentFileRecord, TAG_NTFS); return STATUS_NOT_IMPLEMENTED; } // Update the length of the attribute in the file record of the parent directory - InternalSetResidentAttributeLength(DirectoryContext, + InternalSetResidentAttributeLength(IndexRootContext, ParentFileRecord, IndexRootOffset, AttributeLength); @@ -249,7 +249,7 @@ // Update the parent directory with the new index root Status = WriteAttribute(DeviceExt, - DirectoryContext, + IndexRootContext, 0, (PUCHAR)NewIndexRoot, AttributeLength, @@ -258,7 +258,7 @@ { DPRINT1("ERROR: Unable to write new index root attribute to parent directory!\n"); ExFreePoolWithTag(NewIndexRoot, TAG_NTFS); - ReleaseAttributeContext(DirectoryContext); + ReleaseAttributeContext(IndexRootContext); ExFreePoolWithTag(I30IndexRoot, TAG_NTFS); ExFreePoolWithTag(ParentFileRecord, TAG_NTFS); return Status; @@ -278,7 +278,7 @@ // Cleanup ExFreePoolWithTag(NewIndexRoot, TAG_NTFS); - ReleaseAttributeContext(DirectoryContext); + ReleaseAttributeContext(IndexRootContext); ExFreePoolWithTag(I30IndexRoot, TAG_NTFS); ExFreePoolWithTag(ParentFileRecord, TAG_NTFS);
7 years, 6 months
1
0
0
0
← Newer
1
2
3
4
5
6
7
8
9
...
53
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
Results per page:
10
25
50
100
200