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
2026
April
March
February
January
2025
December
November
October
September
August
July
June
May
April
March
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
----- 2026 -----
April 2026
March 2026
February 2026
January 2026
----- 2025 -----
December 2025
November 2025
October 2025
September 2025
August 2025
July 2025
June 2025
May 2025
April 2025
March 2025
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
81390 discussions
Start a n
N
ew thread
[reactos] 01/01: [SHELL32] Improve and fix SendTo (#2122)
by Katayama Hirofumi MZ
01 Dec '19
01 Dec '19
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b582d6ff459e49a5b0c84…
commit b582d6ff459e49a5b0c8459c10fedbae02fb3239 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Mon Dec 2 04:06:20 2019 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Mon Dec 2 04:06:20 2019 +0900 [SHELL32] Improve and fix SendTo (#2122) Because of timing of SendTo folder initialization, SendTo My Documents didn't work well. Now My Documents item is working well. CORE-12562 --- dll/win32/shell32/CSendToMenu.cpp | 159 +++++++++++++++++++++++++++++++++++++ dll/win32/shell32/CSendToMenu.h | 3 + dll/win32/shell32/wine/shellpath.c | 128 ----------------------------- 3 files changed, 162 insertions(+), 128 deletions(-) diff --git a/dll/win32/shell32/CSendToMenu.cpp b/dll/win32/shell32/CSendToMenu.cpp index 9e9fbe8afeb..8a7e1bc0bd8 100644 --- a/dll/win32/shell32/CSendToMenu.cpp +++ b/dll/win32/shell32/CSendToMenu.cpp @@ -156,10 +156,169 @@ void CSendToMenu::UnloadAllItems() } } +BOOL CSendToMenu::FolderHasAnyItems() const +{ + WCHAR szPath[MAX_PATH]; + SHGetSpecialFolderPathW(NULL, szPath, CSIDL_SENDTO, FALSE); + + PathAppendW(szPath, L"*"); + + WIN32_FIND_DATAW find; + HANDLE hFind = FindFirstFileW(szPath, &find); + if (hFind == INVALID_HANDLE_VALUE) + return FALSE; + + BOOL bFound = FALSE; + do + { + if (wcscmp(find.cFileName, L".") == 0 || + wcscmp(find.cFileName, L"..") == 0 || + _wcsicmp(find.cFileName, L"desktop.ini") == 0) + { + continue; + } + + bFound = TRUE; + break; + } while (FindNextFileW(hFind, &find)); + + FindClose(hFind); + return bFound; +} + +static BOOL CreateEmptyFile(LPCWSTR pszFile) +{ + HANDLE hFile; + hFile = CreateFileW(pszFile, GENERIC_WRITE, FILE_SHARE_READ, NULL, + CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + CloseHandle(hFile); + return hFile != INVALID_HANDLE_VALUE; +} + +static HRESULT +CreateShellLink( + LPCWSTR pszLinkPath, + LPCWSTR pszTargetPath OPTIONAL, + LPCITEMIDLIST pidlTarget OPTIONAL, + LPCWSTR pszArg OPTIONAL, + LPCWSTR pszDir OPTIONAL, + LPCWSTR pszIconPath OPTIONAL, + INT iIconNr OPTIONAL, + LPCWSTR pszComment OPTIONAL) +{ + CComPtr<IShellLinkW> psl; + HRESULT hr = CoCreateInstance(CLSID_ShellLink, NULL, + CLSCTX_INPROC_SERVER, + IID_PPV_ARG(IShellLinkW, &psl)); + if (FAILED_UNEXPECTEDLY(hr)) + return hr; + + if (pszTargetPath) + { + hr = psl->SetPath(pszTargetPath); + if (FAILED_UNEXPECTEDLY(hr)) + return hr; + } + else if (pidlTarget) + { + hr = psl->SetIDList(pidlTarget); + if (FAILED_UNEXPECTEDLY(hr)) + return hr; + } + else + { + ERR("invalid argument\n"); + return E_INVALIDARG; + } + + if (pszArg) + hr = psl->SetArguments(pszArg); + + if (pszDir) + hr = psl->SetWorkingDirectory(pszDir); + + if (pszIconPath) + hr = psl->SetIconLocation(pszIconPath, iIconNr); + + if (pszComment) + hr = psl->SetDescription(pszComment); + + CComPtr<IPersistFile> ppf; + hr = psl->QueryInterface(IID_PPV_ARG(IPersistFile, &ppf)); + if (FAILED_UNEXPECTEDLY(hr)) + return hr; + + hr = ppf->Save(pszLinkPath, TRUE); + if (FAILED_UNEXPECTEDLY(hr)) + return hr; + + return hr; +} + +HRESULT CSendToMenu::CreateSendToFiles(LPCWSTR pszSendTo) +{ + WCHAR szTarget[MAX_PATH]; + WCHAR szSendToFile[MAX_PATH]; + WCHAR szShell32[MAX_PATH]; + HRESULT hr; + + /* create my documents */ + SHGetSpecialFolderPathW(NULL, szTarget, CSIDL_MYDOCUMENTS, FALSE); + + StringCbCopyW(szSendToFile, sizeof(szSendToFile), pszSendTo); + PathAppendW(szSendToFile, PathFindFileNameW(szTarget)); + StringCbCatW(szSendToFile, sizeof(szSendToFile), L".lnk"); + + GetSystemDirectoryW(szShell32, ARRAY_SIZE(szShell32)); + PathAppendW(szShell32, L"shell32.dll"); + hr = CreateShellLink(szSendToFile, szTarget, NULL, NULL, NULL, + szShell32, -IDI_SHELL_MY_DOCUMENTS, NULL); + if (FAILED_UNEXPECTEDLY(hr)) + ; + + /* create desklink */ + StringCbCopyW(szSendToFile, sizeof(szSendToFile), pszSendTo); + LoadStringW(shell32_hInstance, IDS_DESKLINK, szTarget, _countof(szTarget)); + StringCbCatW(szTarget, sizeof(szTarget), L".DeskLink"); + PathAppendW(szSendToFile, szTarget); + if (!CreateEmptyFile(szSendToFile)) + { + ERR("CreateEmptyFile\n"); + } + + /* create zipped compressed folder */ + HINSTANCE hZipFldr = + LoadLibraryExW(L"zipfldr.dll", NULL, LOAD_LIBRARY_AS_DATAFILE); + if (hZipFldr) + { +#define IDS_FRIENDLYNAME 10195 + LoadStringW(hZipFldr, IDS_FRIENDLYNAME, szTarget, _countof(szTarget)); +#undef IDS_FRIENDLYNAME + FreeLibrary(hZipFldr); + + StringCbCopyW(szSendToFile, sizeof(szSendToFile), pszSendTo); + PathAppendW(szSendToFile, szTarget); + StringCbCatW(szSendToFile, sizeof(szSendToFile), L".ZFSendToTarget"); + if (!CreateEmptyFile(szSendToFile)) + { + ERR("CreateEmptyFile\n"); + } + } + + return S_OK; +} + HRESULT CSendToMenu::LoadAllItems(HWND hwnd) { UnloadAllItems(); + if (!FolderHasAnyItems()) + { + WCHAR szPath[MAX_PATH]; + SHGetSpecialFolderPathW(NULL, szPath, CSIDL_SENDTO, FALSE); + CreateSendToFiles(szPath); + } + CComHeapPtr<ITEMIDLIST_ABSOLUTE> pidlSendTo; m_pSendTo.Release(); diff --git a/dll/win32/shell32/CSendToMenu.h b/dll/win32/shell32/CSendToMenu.h index 2f59319921e..2156f1ee75e 100644 --- a/dll/win32/shell32/CSendToMenu.h +++ b/dll/win32/shell32/CSendToMenu.h @@ -69,6 +69,9 @@ private: HRESULT LoadAllItems(HWND hwnd); void UnloadAllItems(); + BOOL FolderHasAnyItems() const; + HRESULT CreateSendToFiles(LPCWSTR pszSendTo); + UINT InsertSendToItems(HMENU hMenu, UINT idFirst, UINT idMenu); SENDTO_ITEM *FindItemFromIdOffset(UINT IdOffset); diff --git a/dll/win32/shell32/wine/shellpath.c b/dll/win32/shell32/wine/shellpath.c index 984116f8a38..9ca628f4bbe 100644 --- a/dll/win32/shell32/wine/shellpath.c +++ b/dll/win32/shell32/wine/shellpath.c @@ -2146,129 +2146,6 @@ cleanup: return hr; } -static HRESULT -CreateShellLink( - LPCWSTR pszLinkPath, - LPCWSTR pszCmd, - LPCWSTR pszArg OPTIONAL, - LPCWSTR pszDir OPTIONAL, - LPCWSTR pszIconPath OPTIONAL, - INT iIconNr OPTIONAL, - LPCWSTR pszComment OPTIONAL) -{ - IShellLinkW *psl; - IPersistFile *ppf; - - HRESULT hr = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, &IID_IShellLink, (LPVOID*)&psl); - if (FAILED_UNEXPECTEDLY(hr)) - return hr; - - hr = IShellLinkW_SetPath(psl, pszCmd); - if (FAILED_UNEXPECTEDLY(hr)) - { - IShellLinkW_Release(psl); - return hr; - } - - if (pszArg) - hr = IShellLinkW_SetArguments(psl, pszArg); - - if (pszDir) - hr = IShellLinkW_SetWorkingDirectory(psl, pszDir); - - if (pszIconPath) - hr = IShellLinkW_SetIconLocation(psl, pszIconPath, iIconNr); - - if (pszComment) - hr = IShellLinkW_SetDescription(psl, pszComment); - - hr = IShellLinkW_QueryInterface(psl, &IID_IPersistFile, (LPVOID*)&ppf); - - if (SUCCEEDED(hr)) - { - hr = IPersistFile_Save(ppf, pszLinkPath, TRUE); - IPersistFile_Release(ppf); - } - - IShellLinkW_Release(psl); - - return hr; -} - -static HRESULT -CreateShellLinkCoInit( - LPCWSTR pszLinkPath, - LPCWSTR pszCmd, - LPCWSTR pszArg OPTIONAL, - LPCWSTR pszDir OPTIONAL, - LPCWSTR pszIconPath OPTIONAL, - INT iIconNr OPTIONAL, - LPCWSTR pszComment OPTIONAL) -{ - HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); - BOOL bCoInit = (hr == S_OK); - - hr = CreateShellLink(pszLinkPath, pszCmd, pszArg, pszDir, - pszIconPath, iIconNr, pszComment); - - if (bCoInit) - CoUninitialize(); - - return hr; -} - -HRESULT DoCreateSendToFiles(LPCWSTR pszSendTo) -{ - WCHAR szTarget[MAX_PATH]; - WCHAR szSendToFile[MAX_PATH]; - WCHAR szShell32[MAX_PATH]; - HRESULT hr; - HANDLE hFile; - HINSTANCE hZipFldr; - - /* create my documents */ - SHGetSpecialFolderPathW(NULL, szTarget, CSIDL_MYDOCUMENTS, TRUE); - - StringCbCopyW(szSendToFile, sizeof(szSendToFile), pszSendTo); - PathAppendW(szSendToFile, PathFindFileNameW(szTarget)); - StringCbCatW(szSendToFile, sizeof(szSendToFile), L".lnk"); - - GetSystemDirectoryW(szShell32, ARRAY_SIZE(szShell32)); - PathAppendW(szShell32, L"shell32.dll"); - hr = CreateShellLinkCoInit(szSendToFile, szTarget, NULL, NULL, - szShell32, -IDI_SHELL_MY_DOCUMENTS, NULL); - if (FAILED_UNEXPECTEDLY(hr)) - return hr; - - /* create desklink */ - StringCbCopyW(szSendToFile, sizeof(szSendToFile), pszSendTo); - LoadStringW(shell32_hInstance, IDS_DESKLINK, szTarget, _countof(szTarget)); - StringCbCatW(szTarget, sizeof(szTarget), L".DeskLink"); - PathAppendW(szSendToFile, szTarget); - hFile = CreateFileW(szSendToFile, GENERIC_WRITE, FILE_SHARE_READ, NULL, - CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - CloseHandle(hFile); - - /* create zipped compressed folder */ - hZipFldr = LoadLibraryW(L"zipfldr.dll"); - if (hZipFldr) - { -#define IDS_FRIENDLYNAME 10195 - LoadStringW(hZipFldr, IDS_FRIENDLYNAME, szTarget, _countof(szTarget)); -#undef IDS_FRIENDLYNAME - FreeLibrary(hZipFldr); - - StringCbCopyW(szSendToFile, sizeof(szSendToFile), pszSendTo); - PathAppendW(szSendToFile, szTarget); - StringCbCatW(szSendToFile, sizeof(szSendToFile), L".ZFSendToTarget"); - hFile = CreateFileW(szSendToFile, GENERIC_WRITE, FILE_SHARE_READ, NULL, - CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - CloseHandle(hFile); - } - - return S_OK; -} - /************************************************************************* * SHGetFolderPathAndSubDirW [SHELL32.@] */ @@ -2408,11 +2285,6 @@ HRESULT WINAPI SHGetFolderPathAndSubDirW( TRACE("Created missing system directory %s\n", debugstr_w(szBuildPath)); end: - if ((nFolder & CSIDL_FLAG_CREATE) && folder == CSIDL_SENDTO) - { - DoCreateSendToFiles(szBuildPath); - } - /* create desktop.ini for custom icon */ if ((nFolder & CSIDL_FLAG_CREATE) && CSIDL_Data[folder].nShell32IconIndex)
1
0
0
0
[reactos] 01/01: [WBEMPROX_WINETEST] Sync with Wine Staging 4.18. CORE-16441
by Amine Khaldi
01 Dec '19
01 Dec '19
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=92c3c814bb57107379628…
commit 92c3c814bb571073796287df4eb0eb3fc58e4c6e Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sun Dec 1 19:45:25 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Dec 1 19:45:25 2019 +0100 [WBEMPROX_WINETEST] Sync with Wine Staging 4.18. CORE-16441 --- modules/rostests/winetests/wbemprox/query.c | 959 +++++++++++++--------------- 1 file changed, 454 insertions(+), 505 deletions(-) diff --git a/modules/rostests/winetests/wbemprox/query.c b/modules/rostests/winetests/wbemprox/query.c index 0fa6b5e9668..40eaefee4c7 100644 --- a/modules/rostests/winetests/wbemprox/query.c +++ b/modules/rostests/winetests/wbemprox/query.c @@ -46,6 +46,8 @@ static HRESULT exec_query( IWbemServices *services, const WCHAR *str, IEnumWbemC for (;;) { VARIANT var; + IWbemQualifierSet *qualifiers; + SAFEARRAY *names; IEnumWbemClassObject_Next( *result, 10000, 1, &obj, &count ); if (!count) break; @@ -60,6 +62,15 @@ static HRESULT exec_query( IWbemServices *services, const WCHAR *str, IEnumWbemC trace("description: %s\n", wine_dbgstr_w(V_BSTR(&var))); VariantClear( &var ); } + + hr = IWbemClassObject_GetQualifierSet( obj, &qualifiers ); + ok( hr == S_OK, "got %08x\n", hr ); + + hr = IWbemQualifierSet_GetNames( qualifiers, 0, &names ); + ok( hr == S_OK, "got %08x\n", hr ); + + SafeArrayDestroy( names ); + IWbemQualifierSet_Release( qualifiers ); IWbemClassObject_Release( obj ); } } @@ -112,8 +123,14 @@ static void test_select( IWbemServices *services ) static const WCHAR query13[] = {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_','B','I','O','S', ' ','W','H','E','R','E',' ','N','U','L','L',' ','=',' ','N','A','M','E', 0}; + static const WCHAR query14[] = + {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', + 'L','o','g','i','c','a','l','D','i','s','k','T','o','P','a','r','t','i','t','i','o','n',0}; + static const WCHAR query15[] = + {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', + 'D','i','s','k','D','r','i','v','e','T','o','D','i','s','k','P','a','r','t','i','t','i','o','n',0}; static const WCHAR *test[] = { query1, query2, query3, query4, query5, query6, query7, query8, query9, query10, - query11, query12, query13 }; + query11, query12, query13, query14, query15 }; HRESULT hr; IEnumWbemClassObject *result; BSTR wql = SysAllocString( wqlW ); @@ -156,14 +173,37 @@ static void test_select( IWbemServices *services ) static void test_associators( IWbemServices *services ) { static const WCHAR query1[] = - {'A','S','S','O','C','I','A','T','O','R','S',' ','O','F',' ','{','W','i','n','3','2','_', + {'A','S','S','O','C','I','A','T','O','R','S',' ',' ','O','F','{','W','i','n','3','2','_', 'L','o','g','i','c','a','l','D','i','s','k','.','D','e','v','i','c','e','I','D','=','"','C',':','"','}',0}; static const WCHAR query2[] = {'A','S','S','O','C','I','A','T','O','R','S',' ','O','F',' ','{','W','i','n','3','2','_', 'L','o','g','i','c','a','l','D','i','s','k','.','D','e','v','i','c','e','I','D','=','"','C',':','"','}',' ', - 'W','H','E','R','E',' ','A','s','s','o','c','C','l','a','s','s',' ','=',' ','W','i','n','3','2','_', + 'W','H','E','R','E',' ','A','s','s','o','c','C','l','a','s','s','=','W','i','n','3','2','_', + 'L','o','g','i','c','a','l','D','i','s','k','T','o','P','a','r','t','i','t','i','o','n',0}; + static const WCHAR query3[] = + {'A','S','S','O','C','I','A','T','O','R','S',' ',' ','O','F',' ','{','W','i','n','3','2','_', + 'L','o','g','i','c','a','l','D','i','s','k','.','D','e','v','i','c','e','I','D','}',0}; + static const WCHAR query4[] = + {'A','S','S','O','C','I','A','T','O','R','S',' ',' ','O','F',' ','{','W','i','n','3','2','_', + 'D','i','s','k','D','r','i','v','e','.','D','e','v','i','c','e','I','D','=', + '\'','\\','\\','.','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','0','\'','}',0}; + static const WCHAR query5[] = + {'A','S','S','O','C','I','A','T','O','R','S',' ','O','F',' ','{','W','i','n','3','2','_', + 'L','o','g','i','c','a','l','D','i','s','k','.','D','e','v','i','c','e','I','D','=','"','C',':','"','}',' ', + 'W','H','E','R','E',' ','A','s','s','o','c','C','l','a','s','s','=','W','i','n','3','2','_', + 'L','o','g','i','c','a','l','D','i','s','k','T','o','P','a','r','t','i','t','i','o','n',' ', + 'C','l','a','s','s','D','e','f','s','O','n','l','y',0}; + static const WCHAR query6[] = + {'A','S','S','O','C','I','A','T','O','R','S',' ','O','F',' ','{','W','i','n','3','2','_', + 'L','o','g','i','c','a','l','D','i','s','k','.','D','e','v','i','c','e','I','D','=','"','C',':','"','}',' ', + 'W','H','E','R','E',' ','C','l','a','s','s','D','e','f','s','O','n','l','y',0}; + static const WCHAR query7[] = + {'A','S','S','O','C','I','A','T','O','R','S',' ','O','F',' ','{','W','i','n','3','2','_', + 'L','o','g','i','c','a','l','D','i','s','k','.','D','e','v','i','c','e','I','D','=','"','C',':','"','}',' ', + 'W','H','E','R','E',' ','C','l','a','s','s','D','e','f','s','O','n','l','y',' ', + 'A','s','s','o','c','C','l','a','s','s',' ','=',' ','W','i','n','3','2','_', 'L','o','g','i','c','a','l','D','i','s','k','T','o','P','a','r','t','i','t','i','o','n',0}; - static const WCHAR *test[] = { query1, query2 }; + static const WCHAR *test[] = { query1, query2, query3, query4, query5, query6, query7 }; HRESULT hr; IEnumWbemClassObject *result; UINT i; @@ -171,22 +211,55 @@ static void test_associators( IWbemServices *services ) for (i = 0; i < ARRAY_SIZE( test ); i++) { hr = exec_query( services, test[i], &result ); - todo_wine ok( hr == S_OK, "query %u failed: %08x\n", i, hr ); + ok( hr == S_OK, "query %u failed: %08x\n", i, hr ); if (result) IEnumWbemClassObject_Release( result ); } } +static void _check_property( ULONG line, IWbemClassObject *obj, const WCHAR *prop, VARTYPE vartype, CIMTYPE cimtype ) +{ + CIMTYPE type = 0xdeadbeef; + VARIANT val; + HRESULT hr; + + VariantInit( &val ); + hr = IWbemClassObject_Get( obj, prop, 0, &val, &type, NULL ); + ok( hr == S_OK, "%u: failed to get description %08x\n", line, hr ); + ok( V_VT( &val ) == vartype, "%u: unexpected variant type 0x%x\n", line, V_VT(&val) ); + ok( type == cimtype, "%u: unexpected type 0x%x\n", line, type ); + switch (V_VT(&val)) + { + case VT_BSTR: + trace( "%s: %s\n", wine_dbgstr_w(prop), wine_dbgstr_w(V_BSTR(&val)) ); + break; + case VT_I2: + trace( "%s: %d\n", wine_dbgstr_w(prop), V_I2(&val) ); + break; + case VT_I4: + trace( "%s: %d\n", wine_dbgstr_w(prop), V_I4(&val) ); + break; + case VT_R4: + trace( "%s: %f\n", wine_dbgstr_w(prop), V_R4(&val) ); + break; + default: + break; + } + VariantClear( &val ); +} +#define check_property(a,b,c,d) _check_property(__LINE__,a,b,c,d) + static void test_Win32_Service( IWbemServices *services ) { - static const WCHAR returnvalueW[] = {'R','e','t','u','r','n','V','a','l','u','e',0}; static const WCHAR pauseserviceW[] = {'P','a','u','s','e','S','e','r','v','i','c','e',0}; + static const WCHAR processidW[] = {'P','r','o','c','e','s','s','I','D',0}; static const WCHAR resumeserviceW[] = {'R','e','s','u','m','e','S','e','r','v','i','c','e',0}; + static const WCHAR returnvalueW[] = {'R','e','t','u','r','n','V','a','l','u','e',0}; + static const WCHAR serviceW[] = {'W','i','n','3','2','_','S','e','r','v','i','c','e','.', + 'N','a','m','e','=','"','S','p','o','o','l','e','r','"',0}; static const WCHAR startserviceW[] = {'S','t','a','r','t','S','e','r','v','i','c','e',0}; - static const WCHAR stopserviceW[] = {'S','t','o','p','S','e','r','v','i','c','e',0}; static const WCHAR stateW[] = {'S','t','a','t','e',0}; static const WCHAR stoppedW[] = {'S','t','o','p','p','e','d',0}; - static const WCHAR serviceW[] = {'W','i','n','3','2','_','S','e','r','v','i','c','e','.', - 'N','a','m','e','=','"','S','p','o','o','l','e','r','"',0}; + static const WCHAR stopserviceW[] = {'S','t','o','p','S','e','r','v','i','c','e',0}; static const WCHAR emptyW[] = {0}; BSTR class = SysAllocString( serviceW ), empty = SysAllocString( emptyW ), method; IWbemClassObject *service, *out; @@ -200,6 +273,8 @@ static void test_Win32_Service( IWbemServices *services ) win_skip( "Win32_Service not available\n" ); goto out; } + + check_property( service, processidW, VT_I4, CIM_UINT32 ); type = 0xdeadbeef; VariantInit( &state ); hr = IWbemClassObject_Get( service, stateW, 0, &state, &type, NULL ); @@ -280,7 +355,7 @@ out: static void test_Win32_Bios( IWbemServices *services ) { static const WCHAR queryW[] = - {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', 'B','i','o','s',0}; + {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_','B','i','o','s',0}; static const WCHAR descriptionW[] = {'D','e','s','c','r','i','p','t','i','o','n',0}; static const WCHAR identificationcodeW[] = {'I','d','e','n','t','i','f','i','c','a','t','i','o','n','C','o','d','e',0}; static const WCHAR manufacturerW[] = {'M','a','n','u','f','a','c','t','u','r','e','r',0}; @@ -305,49 +380,11 @@ static void test_Win32_Bios( IWbemServices *services ) hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); ok( hr == S_OK, "IEnumWbemClassObject_Next failed %08x\n", hr ); - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, descriptionW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get description %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "description: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, identificationcodeW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get identication code %08x\n", hr ); - ok( V_VT( &val ) == VT_NULL, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, manufacturerW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get manufacturer %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "manufacturer: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, nameW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get name %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "name: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, releasedateW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get release date %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_DATETIME, "unexpected type 0x%x\n", type ); - trace( "release date: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); + check_property( obj, descriptionW, VT_BSTR, CIM_STRING ); + check_property( obj, identificationcodeW, VT_NULL, CIM_STRING ); + check_property( obj, manufacturerW, VT_BSTR, CIM_STRING ); + check_property( obj, nameW, VT_BSTR, CIM_STRING ); + check_property( obj, releasedateW, VT_BSTR, CIM_DATETIME ); type = 0xdeadbeef; VariantInit( &val ); @@ -358,40 +395,62 @@ static void test_Win32_Bios( IWbemServices *services ) ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); VariantClear( &val ); - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, smbiosbiosversionW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get bios version %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "bios version: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); + check_property( obj, smbiosbiosversionW, VT_BSTR, CIM_STRING ); + check_property( obj, smbiosmajorversionW, VT_I4, CIM_UINT16 ); + check_property( obj, smbiosminorversionW, VT_I4, CIM_UINT16 ); + check_property( obj, versionW, VT_BSTR, CIM_STRING ); - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, smbiosmajorversionW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get bios major version %08x\n", hr ); - ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT16, "unexpected type 0x%x\n", type ); - trace( "bios major version: %u\n", V_I4( &val ) ); + IWbemClassObject_Release( obj ); + IEnumWbemClassObject_Release( result ); + SysFreeString( query ); + SysFreeString( wql ); +} - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, smbiosminorversionW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get bios minor version %08x\n", hr ); - ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT16, "unexpected type 0x%x\n", type ); - trace( "bios minor version: %u\n", V_I4( &val ) ); +static void test_Win32_Baseboard( IWbemServices *services ) +{ + static const WCHAR queryW[] = + {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_','B','a','s','e','b','o','a','r','d',0}; + static const WCHAR manufacturerW[] = {'M','a','n','u','f','a','c','t','u','r','e','r',0}; + static const WCHAR modelW[] = {'M','o','d','e','l',0}; + static const WCHAR nameW[] = {'N','a','m','e',0}; + static const WCHAR productW[] = {'P','r','o','d','u','c','t',0}; + static const WCHAR tagW[] = {'T','a','g',0}; + static const WCHAR versionW[] = {'V','e','r','s','i','o','n',0}; + BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); + IEnumWbemClassObject *result; + IWbemClassObject *obj; + CIMTYPE type; + ULONG count; + VARIANT val; + HRESULT hr; + + hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result ); + ok( hr == S_OK, "IWbemServices_ExecQuery failed %08x\n", hr ); + + hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); + if (hr != S_OK) + { + win_skip( "Win32_Baseboard not available\n" ); + return; + } + ok( hr == S_OK, "IEnumWbemClassObject_Next failed %08x\n", hr ); + + check_property( obj, manufacturerW, VT_BSTR, CIM_STRING ); type = 0xdeadbeef; VariantInit( &val ); - hr = IWbemClassObject_Get( obj, versionW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get version %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); + hr = IWbemClassObject_Get( obj, modelW, 0, &val, &type, NULL ); + ok( hr == S_OK, "failed to get model %08x\n", hr ); + ok( V_VT( &val ) == VT_BSTR || V_VT( &val ) == VT_NULL, "unexpected variant type 0x%x\n", V_VT( &val ) ); ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "version: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); + trace( "model: %s\n", wine_dbgstr_w(V_BSTR(&val)) ); VariantClear( &val ); + check_property( obj, nameW, VT_BSTR, CIM_STRING ); + check_property( obj, productW, VT_BSTR, CIM_STRING ); + check_property( obj, tagW, VT_BSTR, CIM_STRING ); + check_property( obj, versionW, VT_BSTR, CIM_STRING ); + IWbemClassObject_Release( obj ); IEnumWbemClassObject_Release( result ); SysFreeString( query ); @@ -417,7 +476,7 @@ static void test_Win32_Process( IWbemServices *services, BOOL use_full_path ) BSTR class, method; IWbemClassObject *process, *sig_in, *out; IWbemQualifierSet *qualifiers; - VARIANT user, domain, retval, val; + VARIANT retval, val; DWORD full_path_len = 0; LONG flavor; CIMTYPE type; @@ -466,21 +525,8 @@ static void test_Win32_Process( IWbemServices *services, BOOL use_full_path ) ok( !V_I4( &retval ), "unexpected error %u\n", V_I4( &retval ) ); ok( type == CIM_UINT32, "unexpected type 0x%x\n", type ); - type = 0xdeadbeef; - VariantInit( &user ); - hr = IWbemClassObject_Get( out, userW, 0, &user, &type, NULL ); - ok( hr == S_OK, "failed to get user %08x\n", hr ); - ok( V_VT( &user ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &user ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace("%s\n", wine_dbgstr_w(V_BSTR(&user))); - - type = 0xdeadbeef; - VariantInit( &domain ); - hr = IWbemClassObject_Get( out, domainW, 0, &domain, &type, NULL ); - ok( hr == S_OK, "failed to get domain %08x\n", hr ); - ok( V_VT( &domain ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &domain ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace("%s\n", wine_dbgstr_w(V_BSTR(&domain))); + check_property( out, userW, VT_BSTR, CIM_STRING ); + check_property( out, domainW, VT_BSTR, CIM_STRING ); hr = IWbemClassObject_GetPropertyQualifierSet( out, userW, &qualifiers ); ok( hr == S_OK, "failed to get qualifier set %08x\n", hr ); @@ -517,8 +563,6 @@ static void test_Win32_Process( IWbemServices *services, BOOL use_full_path ) ok( hr == WBEM_E_NOT_FOUND, "got %08x\n", hr ); IWbemQualifierSet_Release( qualifiers ); - VariantClear( &user ); - VariantClear( &domain ); IWbemClassObject_Release( out ); } @@ -529,12 +573,16 @@ static void test_Win32_ComputerSystem( IWbemServices *services ) static const WCHAR modelW[] = {'M','o','d','e','l',0}; static const WCHAR nameW[] = {'N','a','m','e',0}; static const WCHAR usernameW[] = {'U','s','e','r','N','a','m','e',0}; + static const WCHAR numprocessorsW[] = + {'N','u','m','b','e','r','O','f','P','r','o','c','e','s','s','o','r','s',0}; + static const WCHAR numlogicalprocessorsW[] = + {'N','u','m','b','e','r','O','f','L','o','g','i','c','a','l','P','r','o','c','e','s','s','o','r','s',0}; static const WCHAR queryW[] = {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', 'C','o','m','p','u','t','e','r','S','y','s','t','e','m',0}; BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); IEnumWbemClassObject *result; - IWbemClassObject *service; + IWbemClassObject *obj; VARIANT value; CIMTYPE type; HRESULT hr; @@ -565,26 +613,19 @@ static void test_Win32_ComputerSystem( IWbemServices *services ) goto out; } - hr = IEnumWbemClassObject_Next( result, 10000, 1, &service, &count ); + hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); ok( hr == S_OK, "got %08x\n", hr ); type = 0xdeadbeef; VariantInit( &value ); - hr = IWbemClassObject_Get( service, memorytypeW, 0, &value, &type, NULL ); + hr = IWbemClassObject_Get( obj, memorytypeW, 0, &value, &type, NULL ); ok( hr == WBEM_E_NOT_FOUND, "got %08x\n", hr ); - type = 0xdeadbeef; - VariantInit( &value ); - hr = IWbemClassObject_Get( service, modelW, 0, &value, &type, NULL ); - ok( hr == S_OK, "failed to get model %08x\n", hr ); - ok( V_VT( &value ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &value ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "model: %s\n", wine_dbgstr_w(V_BSTR( &value )) ); - VariantClear( &value ); + check_property( obj, modelW, VT_BSTR, CIM_STRING ); type = 0xdeadbeef; VariantInit( &value ); - hr = IWbemClassObject_Get( service, nameW, 0, &value, &type, NULL ); + hr = IWbemClassObject_Get( obj, nameW, 0, &value, &type, NULL ); ok( hr == S_OK, "failed to get computer name %08x\n", hr ); ok( V_VT( &value ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &value ) ); ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); @@ -593,14 +634,27 @@ static void test_Win32_ComputerSystem( IWbemServices *services ) type = 0xdeadbeef; VariantInit( &value ); - hr = IWbemClassObject_Get( service, usernameW, 0, &value, &type, NULL ); + hr = IWbemClassObject_Get( obj, numlogicalprocessorsW, 0, &value, &type, NULL ); + ok( hr == S_OK || broken(hr == WBEM_E_NOT_FOUND) /* win2k3 */, "got %08x\n", hr ); + if (hr == S_OK) + { + ok( V_VT( &value ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &value ) ); + ok( type == CIM_UINT32, "unexpected type 0x%x\n", type ); + trace( "numlogicalprocessors %u\n", V_I4( &value ) ); + } + + check_property( obj, numprocessorsW, VT_I4, CIM_UINT32 ); + + type = 0xdeadbeef; + VariantInit( &value ); + hr = IWbemClassObject_Get( obj, usernameW, 0, &value, &type, NULL ); ok( hr == S_OK, "failed to get computer name %08x\n", hr ); ok( V_VT( &value ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &value ) ); ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); ok( !lstrcmpiW( V_BSTR( &value ), username ), "got %s, expected %s\n", wine_dbgstr_w(V_BSTR(&value)), wine_dbgstr_w(username) ); VariantClear( &value ); - IWbemClassObject_Release( service ); + IWbemClassObject_Release( obj ); IEnumWbemClassObject_Release( result ); out: SysFreeString( query ); @@ -634,14 +688,7 @@ static void test_Win32_SystemEnclosure( IWbemServices *services ) hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); ok( hr == S_OK, "IEnumWbemClassObject_Next failed %08x\n", hr ); - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, captionW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get caption %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "caption: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); + check_property( obj, captionW, VT_BSTR, CIM_STRING ); type = 0xdeadbeef; VariantInit( &val ); @@ -669,50 +716,11 @@ static void test_Win32_SystemEnclosure( IWbemServices *services ) } VariantClear( &val ); - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, descriptionW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get description %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "description: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, lockpresentW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get lockpresent %08x\n", hr ); - ok( V_VT( &val ) == VT_BOOL, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_BOOLEAN, "unexpected type 0x%x\n", type ); - trace( "lockpresent: %u\n", V_BOOL( &val ) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, manufacturerW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get manufacturer %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "manufacturer: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, nameW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get name %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "name: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, tagW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get tag %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "tag: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); + check_property( obj, descriptionW, VT_BSTR, CIM_STRING ); + check_property( obj, lockpresentW, VT_BOOL, CIM_BOOLEAN ); + check_property( obj, manufacturerW, VT_BSTR, CIM_STRING ); + check_property( obj, nameW, VT_BSTR, CIM_STRING ); + check_property( obj, tagW, VT_BSTR, CIM_STRING ); IWbemClassObject_Release( obj ); IEnumWbemClassObject_Release( result ); @@ -742,7 +750,7 @@ static void test_StdRegProv( IWbemServices *services ) {'S','o','f','t','w','a','r','e','\\','S','t','d','R','e','g','P','r','o','v','T','e','s','t',0}; BSTR class = SysAllocString( stdregprovW ), method, name; IWbemClassObject *reg, *sig_in, *sig_out, *in, *out; - VARIANT defkey, subkey, retval, names, types, value, valuename; + VARIANT defkey, subkey, retval, valuename; CIMTYPE type; HRESULT hr; LONG res; @@ -844,14 +852,8 @@ static void test_StdRegProv( IWbemServices *services ) ok( !V_I4( &retval ), "unexpected error %u\n", V_UI4( &retval ) ); ok( type == CIM_UINT32, "unexpected type 0x%x\n", type ); - type = 0xdeadbeef; - VariantInit( &names ); - hr = IWbemClassObject_Get( out, namesW, 0, &names, &type, NULL ); - ok( hr == S_OK, "failed to get names %08x\n", hr ); - ok( V_VT( &names ) == (VT_BSTR|VT_ARRAY), "unexpected variant type 0x%x\n", V_VT( &names ) ); - ok( type == (CIM_STRING|CIM_FLAG_ARRAY), "unexpected type 0x%x\n", type ); + check_property( out, namesW, VT_BSTR|VT_ARRAY, CIM_STRING|CIM_FLAG_ARRAY ); - VariantClear( &names ); VariantClear( &subkey ); IWbemClassObject_Release( in ); IWbemClassObject_Release( out ); @@ -887,22 +889,9 @@ static void test_StdRegProv( IWbemServices *services ) ok( !V_I4( &retval ), "unexpected error %u\n", V_I4( &retval ) ); ok( type == CIM_UINT32, "unexpected type 0x%x\n", type ); - type = 0xdeadbeef; - VariantInit( &names ); - hr = IWbemClassObject_Get( out, namesW, 0, &names, &type, NULL ); - ok( hr == S_OK, "failed to get names %08x\n", hr ); - ok( V_VT( &names ) == (VT_BSTR|VT_ARRAY), "unexpected variant type 0x%x\n", V_VT( &names ) ); - ok( type == (CIM_STRING|CIM_FLAG_ARRAY), "unexpected type 0x%x\n", type ); + check_property( out, namesW, VT_BSTR|VT_ARRAY, CIM_STRING|CIM_FLAG_ARRAY ); + check_property( out, typesW, VT_I4|VT_ARRAY, CIM_SINT32|CIM_FLAG_ARRAY ); - type = 0xdeadbeef; - VariantInit( &types ); - hr = IWbemClassObject_Get( out, typesW, 0, &types, &type, NULL ); - ok( hr == S_OK, "failed to get names %08x\n", hr ); - ok( V_VT( &types ) == (VT_I4|VT_ARRAY), "unexpected variant type 0x%x\n", V_VT( &types ) ); - ok( type == (CIM_SINT32|CIM_FLAG_ARRAY), "unexpected type 0x%x\n", type ); - - VariantClear( &types ); - VariantClear( &names ); VariantClear( &subkey ); IWbemClassObject_Release( in ); IWbemClassObject_Release( out ); @@ -943,14 +932,8 @@ static void test_StdRegProv( IWbemServices *services ) ok( !V_I4( &retval ), "unexpected error %u\n", V_I4( &retval ) ); ok( type == CIM_UINT32, "unexpected type 0x%x\n", type ); - type = 0xdeadbeef; - VariantInit( &value ); - hr = IWbemClassObject_Get( out, valueW, 0, &value, &type, NULL ); - ok( hr == S_OK, "failed to get value %08x\n", hr ); - ok( V_VT( &value ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &value ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); + check_property( out, valueW, VT_BSTR, CIM_STRING ); - VariantClear( &value ); VariantClear( &valuename ); VariantClear( &subkey ); IWbemClassObject_Release( in ); @@ -1061,6 +1044,34 @@ static void test_query_async( IWbemServices *services ) SysFreeString( query ); } +static void test_query_semisync( IWbemServices *services ) +{ + static const WCHAR queryW[] = + {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_','D','u','m','m','y',0}; + BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); + IEnumWbemClassObject *result; + IWbemClassObject *obj; + ULONG count; + HRESULT hr; + + hr = IWbemServices_ExecQuery( services, wql, query, WBEM_FLAG_RETURN_IMMEDIATELY | WBEM_FLAG_FORWARD_ONLY, + NULL, &result ); + ok( hr == S_OK, "got %08x\n", hr ); + + count = 1; + obj = (void *)0xdeadbeef; + hr = IEnumWbemClassObject_Next( result, -1, 1, &obj, &count ); +todo_wine + ok( hr == WBEM_E_INVALID_CLASS, "Unexpected hr %#x.\n", hr ); + ok( count == 0, "Unexpected count %u.\n", count ); + ok( obj == (void *)0xdeadbeef, "Got object %p\n", obj ); + + IEnumWbemClassObject_Release( result ); + + SysFreeString( wql ); + SysFreeString( query ); +} + static void test_GetNames( IWbemServices *services ) { static const WCHAR queryW[] = @@ -1181,8 +1192,12 @@ static void test_Win32_OperatingSystem( IWbemServices *services ) static const WCHAR buildnumberW[] = {'B','u','i','l','d','N','u','m','b','e','r',0}; static const WCHAR captionW[] = {'C','a','p','t','i','o','n',0}; static const WCHAR csdversionW[] = {'C','S','D','V','e','r','s','i','o','n',0}; + static const WCHAR csnameW[] = {'C','S','N','a','m','e',0}; + static const WCHAR currenttimezoneW[] = {'C','u','r','r','e','n','t','T','i','m','e','Z','o','n','e',0}; static const WCHAR freephysicalmemoryW[] = {'F','r','e','e','P','h','y','s','i','c','a','l','M','e','m','o','r','y',0}; + static const WCHAR manufacturerW[] = {'M','a','n','u','f','a','c','t','u','r','e','r',0}; static const WCHAR nameW[] = {'N','a','m','e',0}; + static const WCHAR operatingsystemskuW[] = {'O','p','e','r','a','t','i','n','g','S','y','s','t','e','m','S','K','U',0}; static const WCHAR osproductsuiteW[] = {'O','S','P','r','o','d','u','c','t','S','u','i','t','e',0}; static const WCHAR ostypeW[] = {'O','S','T','y','p','e',0}; static const WCHAR suitemaskW[] = {'S','u','i','t','e','M','a','s','k',0}; @@ -1191,6 +1206,8 @@ static void test_Win32_OperatingSystem( IWbemServices *services ) {'S','e','r','v','i','c','e','P','a','c','k','M','a','j','o','r','V','e','r','s','i','o','n',0}; static const WCHAR servicepackminorW[] = {'S','e','r','v','i','c','e','P','a','c','k','M','i','n','o','r','V','e','r','s','i','o','n',0}; + static const WCHAR systemdriveW[] = + {'S','y','s','t','e','m','D','r','i','v','e',0}; static const WCHAR totalvisiblememorysizeW[] = {'T','o','t','a','l','V','i','s','i','b','l','e','M','e','m','o','r','y','S','i','z','e',0}; static const WCHAR totalvirtualmemorysizeW[] = @@ -1217,23 +1234,8 @@ static void test_Win32_OperatingSystem( IWbemServices *services ) hr = IWbemClassObject_EndEnumeration( obj ); ok( hr == S_OK, "got %08x\n", hr ); - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, buildnumberW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get buildnumber %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "buildnumber: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, captionW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get caption %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "caption: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); + check_property( obj, buildnumberW, VT_BSTR, CIM_STRING ); + check_property( obj, captionW, VT_BSTR, CIM_STRING ); type = 0xdeadbeef; VariantInit( &val ); @@ -1244,23 +1246,20 @@ static void test_Win32_OperatingSystem( IWbemServices *services ) trace( "csdversion: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); VariantClear( &val ); - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, freephysicalmemoryW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get free physical memory size %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT64, "unexpected type 0x%x\n", type ); - trace( "freephysicalmemory %s\n", wine_dbgstr_w(V_BSTR(&val)) ); - VariantClear( &val ); + check_property( obj, freephysicalmemoryW, VT_BSTR, CIM_UINT64 ); + check_property( obj, nameW, VT_BSTR, CIM_STRING ); type = 0xdeadbeef; VariantInit( &val ); - hr = IWbemClassObject_Get( obj, nameW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get name %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "name: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); + hr = IWbemClassObject_Get( obj, operatingsystemskuW, 0, &val, &type, NULL ); + ok( hr == S_OK || broken(hr == WBEM_E_NOT_FOUND) /* winxp */, "failed to get operatingsystemsku %08x\n", hr ); + if (hr == S_OK) + { + ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); + ok( type == CIM_UINT32, "unexpected type 0x%x\n", type ); + trace( "operatingsystemsku: %08x\n", V_I4( &val ) ); + VariantClear( &val ); + } type = 0xdeadbeef; VariantInit( &val ); @@ -1271,68 +1270,17 @@ static void test_Win32_OperatingSystem( IWbemServices *services ) trace( "osproductsuite: %d (%08x)\n", V_I4( &val ), V_I4( &val ) ); VariantClear( &val ); - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, ostypeW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get ostype %08x\n", hr ); - ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT16, "unexpected type 0x%x\n", type ); - trace( "ostype: %d\n", V_I4( &val ) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, servicepackmajorW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get servicepackmajor %08x\n", hr ); - ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT16, "unexpected type 0x%x\n", type ); - trace( "servicepackmajor: %d\n", V_I4( &val ) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, servicepackminorW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get servicepackminor %08x\n", hr ); - ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT16, "unexpected type 0x%x\n", type ); - trace( "servicepackminor: %d\n", V_I4( &val ) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, suitemaskW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get suitemask %08x\n", hr ); - ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT32, "unexpected type 0x%x\n", type ); - trace( "suitemask: %d (%08x)\n", V_I4( &val ), V_I4( &val ) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, versionW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get version %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "version: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, totalvisiblememorysizeW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get visible memory size %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT64, "unexpected type 0x%x\n", type ); - trace( "totalvisiblememorysize %s\n", wine_dbgstr_w(V_BSTR(&val)) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, totalvirtualmemorysizeW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get virtual memory size %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT64, "unexpected type 0x%x\n", type ); - trace( "totalvirtualmemorysize %s\n", wine_dbgstr_w(V_BSTR(&val)) ); - VariantClear( &val ); + check_property( obj, csnameW, VT_BSTR, CIM_STRING ); + check_property( obj, currenttimezoneW, VT_I2, CIM_SINT16 ); + check_property( obj, manufacturerW, VT_BSTR, CIM_STRING ); + check_property( obj, ostypeW, VT_I4, CIM_UINT16 ); + check_property( obj, servicepackmajorW, VT_I4, CIM_UINT16 ); + check_property( obj, servicepackminorW, VT_I4, CIM_UINT16 ); + check_property( obj, suitemaskW, VT_I4, CIM_UINT32 ); + check_property( obj, versionW, VT_BSTR, CIM_STRING ); + check_property( obj, totalvisiblememorysizeW, VT_BSTR, CIM_UINT64 ); + check_property( obj, totalvirtualmemorysizeW, VT_BSTR, CIM_UINT64 ); + check_property( obj, systemdriveW, VT_BSTR, CIM_STRING ); IWbemClassObject_Release( obj ); IEnumWbemClassObject_Release( result ); @@ -1360,8 +1308,6 @@ static void test_Win32_ComputerSystemProduct( IWbemServices *services ) BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); IEnumWbemClassObject *result; IWbemClassObject *obj; - VARIANT value; - CIMTYPE type; HRESULT hr; DWORD count; @@ -1375,58 +1321,12 @@ static void test_Win32_ComputerSystemProduct( IWbemServices *services ) hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); ok( hr == S_OK, "got %08x\n", hr ); - type = 0xdeadbeef; - VariantInit( &value ); - hr = IWbemClassObject_Get( obj, identifyingnumberW, 0, &value, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &value ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &value ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "identifyingnumber %s\n", wine_dbgstr_w(V_BSTR(&value)) ); - VariantClear( &value ); - - type = 0xdeadbeef; - VariantInit( &value ); - hr = IWbemClassObject_Get( obj, nameW, 0, &value, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &value ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &value ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "name %s\n", wine_dbgstr_w(V_BSTR(&value)) ); - VariantClear( &value ); - - type = 0xdeadbeef; - VariantInit( &value ); - hr = IWbemClassObject_Get( obj, skunumberW, 0, &value, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &value ) == VT_NULL, "unexpected variant type 0x%x\n", V_VT( &value ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - VariantClear( &value ); - - type = 0xdeadbeef; - VariantInit( &value ); - hr = IWbemClassObject_Get( obj, uuidW, 0, &value, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &value ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &value ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "uuid %s\n", wine_dbgstr_w(V_BSTR(&value)) ); - VariantClear( &value ); - - type = 0xdeadbeef; - VariantInit( &value ); - hr = IWbemClassObject_Get( obj, vendorW, 0, &value, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &value ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &value ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "vendor %s\n", wine_dbgstr_w(V_BSTR(&value)) ); - VariantClear( &value ); - - type = 0xdeadbeef; - VariantInit( &value ); - hr = IWbemClassObject_Get( obj, versionW, 0, &value, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &value ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &value ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "version %s\n", wine_dbgstr_w(V_BSTR(&value)) ); - VariantClear( &value ); + check_property( obj, identifyingnumberW, VT_BSTR, CIM_STRING ); + check_property( obj, nameW, VT_BSTR, CIM_STRING ); + check_property( obj, skunumberW, VT_NULL, CIM_STRING ); + check_property( obj, uuidW, VT_BSTR, CIM_STRING ); + check_property( obj, vendorW, VT_BSTR, CIM_STRING ); + check_property( obj, versionW, VT_BSTR, CIM_STRING ); IWbemClassObject_Release( obj ); IEnumWbemClassObject_Release( result ); @@ -1438,14 +1338,13 @@ static void test_Win32_PhysicalMemory( IWbemServices *services ) { static const WCHAR capacityW[] = {'C','a','p','a','c','i','t','y',0}; static const WCHAR memorytypeW[] = {'M','e','m','o','r','y','T','y','p','e',0}; + static const WCHAR devicelocatorW[] = {'D','e','v','i','c','e','L','o','c','a','t','o','r',0}; static const WCHAR queryW[] = {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', 'P','h','y','s','i','c','a','l','M','e','m','o','r','y',0}; BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); IEnumWbemClassObject *result; IWbemClassObject *obj; - VARIANT val; - CIMTYPE type; HRESULT hr; DWORD count; @@ -1461,24 +1360,9 @@ static void test_Win32_PhysicalMemory( IWbemServices *services ) if (count > 0) { - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, capacityW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get capacity %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT64, "unexpected type 0x%x\n", type ); - trace( "capacity %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, memorytypeW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get memory type %08x\n", hr ); - ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT16, "unexpected type 0x%x\n", type ); - trace( "memorytype %u\n", V_I4( &val ) ); - VariantClear( &val ); - + check_property( obj, capacityW, VT_BSTR, CIM_UINT64 ); + check_property( obj, devicelocatorW, VT_BSTR, CIM_STRING ); + check_property( obj, memorytypeW, VT_I4, CIM_UINT16 ); IWbemClassObject_Release( obj ); } IEnumWbemClassObject_Release( result ); @@ -1497,8 +1381,6 @@ static void test_Win32_IP4RouteTable( IWbemServices *services ) BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); IEnumWbemClassObject *result; IWbemClassObject *obj; - VARIANT val; - CIMTYPE type; HRESULT hr; DWORD count; @@ -1514,33 +1396,9 @@ static void test_Win32_IP4RouteTable( IWbemServices *services ) hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); if (hr != S_OK) break; - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, destinationW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get destination %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "destination %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, interfaceindexW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get interface index %08x\n", hr ); - ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_SINT32, "unexpected type 0x%x\n", type ); - trace( "interfaceindex %d\n", V_I4( &val ) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, nexthopW, 0, &val, &type, NULL ); - ok( hr == S_OK, "failed to get nexthop %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "nexthop %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); - + check_property( obj, destinationW, VT_BSTR, CIM_STRING ); + check_property( obj, interfaceindexW, VT_I4, CIM_SINT32 ); + check_property( obj, nexthopW, VT_BSTR, CIM_STRING ); IWbemClassObject_Release( obj ); } @@ -1553,6 +1411,10 @@ static void test_Win32_Processor( IWbemServices *services ) { static const WCHAR architectureW[] = {'A','r','c','h','i','t','e','c','t','u','r','e',0}; + static const WCHAR captionW[] = + {'C','a','p','t','i','o','n',0}; + static const WCHAR cpustatusW[] = + {'C','p','u','S','t','a','t','u','s',0}; static const WCHAR familyW[] = {'F','a','m','i','l','y',0}; static const WCHAR levelW[] = @@ -1561,6 +1423,10 @@ static void test_Win32_Processor( IWbemServices *services ) {'M','a','n','u','f','a','c','t','u','r','e','r',0}; static const WCHAR nameW[] = {'N','a','m','e',0}; + static const WCHAR numcoresW[] = + {'N','u','m','b','e','r','O','f','C','o','r','e','s',0}; + static const WCHAR numlogicalprocessorsW[] = + {'N','u','m','b','e','r','O','f','L','o','g','i','c','a','l','P','r','o','c','e','s','s','o','r','s',0}; static const WCHAR processoridW[] = {'P','r','o','c','e','s','s','o','r','I','d',0}; static const WCHAR revisionW[] = @@ -1586,73 +1452,38 @@ static void test_Win32_Processor( IWbemServices *services ) hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); if (hr != S_OK) break; - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, architectureW, 0, &val, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT16, "unexpected type 0x%x\n", type ); - trace( "architecture %u\n", V_I4( &val ) ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, familyW, 0, &val, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT16, "unexpected type 0x%x\n", type ); - trace( "family %u\n", V_I4( &val ) ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, levelW, 0, &val, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT16, "unexpected type 0x%x\n", type ); - trace( "level %u\n", V_I4( &val ) ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, manufacturerW, 0, &val, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "manufacturer %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, nameW, 0, &val, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "name %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, processoridW, 0, &val, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "processorid %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); + check_property( obj, architectureW, VT_I4, CIM_UINT16 ); + check_property( obj, captionW, VT_BSTR, CIM_STRING ); + check_property( obj, cpustatusW, VT_I4, CIM_UINT16 ); + check_property( obj, familyW, VT_I4, CIM_UINT16 ); + check_property( obj, levelW, VT_I4, CIM_UINT16 ); + check_property( obj, manufacturerW, VT_BSTR, CIM_STRING ); + check_property( obj, nameW, VT_BSTR, CIM_STRING ); + check_property( obj, processoridW, VT_BSTR, CIM_STRING ); + check_property( obj, revisionW, VT_I4, CIM_UINT16 ); + check_property( obj, versionW, VT_BSTR, CIM_STRING ); type = 0xdeadbeef; VariantInit( &val ); - hr = IWbemClassObject_Get( obj, revisionW, 0, &val, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT16, "unexpected type 0x%x\n", type ); - trace( "revision %u\n", V_I4( &val ) ); + hr = IWbemClassObject_Get( obj, numlogicalprocessorsW, 0, &val, &type, NULL ); + ok( hr == S_OK || broken(hr == WBEM_E_NOT_FOUND) /* win2k3 */, "got %08x\n", hr ); + if (hr == S_OK) + { + ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); + ok( type == CIM_UINT32, "unexpected type 0x%x\n", type ); + trace( "numlogicalprocessors %u\n", V_I4( &val ) ); + } type = 0xdeadbeef; VariantInit( &val ); - hr = IWbemClassObject_Get( obj, versionW, 0, &val, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "version %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); + hr = IWbemClassObject_Get( obj, numcoresW, 0, &val, &type, NULL ); + ok( hr == S_OK || broken(hr == WBEM_E_NOT_FOUND) /* win2k3 */, "got %08x\n", hr ); + if (hr == S_OK) + { + ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); + ok( type == CIM_UINT32, "unexpected type 0x%x\n", type ); + trace( "numcores %u\n", V_I4( &val ) ); + } IWbemClassObject_Release( obj ); } @@ -1664,6 +1495,8 @@ static void test_Win32_Processor( IWbemServices *services ) static void test_Win32_VideoController( IWbemServices *services ) { + static const WCHAR availabilityW[] = + {'A','v','a','i','l','a','b','i','l','i','t','y',0}; static const WCHAR configmanagererrorcodeW[] = {'C','o','n','f','i','g','M','a','n','a','g','e','r','E','r','r','o','r','C','o','d','e',0}; static const WCHAR driverdateW[] = @@ -1695,22 +1528,9 @@ static void test_Win32_VideoController( IWbemServices *services ) hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); if (hr != S_OK) break; - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, configmanagererrorcodeW, 0, &val, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_UINT32, "unexpected type 0x%x\n", type ); - trace( "configmanagererrorcode %d\n", V_I4( &val ) ); - - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, driverdateW, 0, &val, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_DATETIME, "unexpected type 0x%x\n", type ); - trace( "driverdate %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); + check_property( obj, availabilityW, VT_I4, CIM_UINT16 ); + check_property( obj, configmanagererrorcodeW, VT_I4, CIM_UINT32 ); + check_property( obj, driverdateW, VT_BSTR, CIM_DATETIME ); type = 0xdeadbeef; VariantInit( &val ); @@ -1721,15 +1541,7 @@ static void test_Win32_VideoController( IWbemServices *services ) trace( "installeddisplaydrivers %s\n", wine_dbgstr_w(V_BSTR( &val )) ); VariantClear( &val ); - type = 0xdeadbeef; - VariantInit( &val ); - hr = IWbemClassObject_Get( obj, statusW, 0, &val, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "status %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); - + check_property( obj, statusW, VT_BSTR, CIM_STRING ); IWbemClassObject_Release( obj ); } @@ -1740,8 +1552,12 @@ static void test_Win32_VideoController( IWbemServices *services ) static void test_Win32_Printer( IWbemServices *services ) { + static const WCHAR attributesW[] = + {'A','t','t','r','i','b','u','t','e','s',0}; static const WCHAR deviceidW[] = {'D','e','v','i','c','e','I','d',0}; + static const WCHAR horizontalresolutionW[] = + {'H','o','r','i','z','o','n','t','a','l','R','e','s','o','l','u','t','i','o','n',0}; static const WCHAR locationW[] = {'L','o','c','a','t','i','o','n',0}; static const WCHAR portnameW[] = @@ -1769,14 +1585,9 @@ static void test_Win32_Printer( IWbemServices *services ) hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); if (hr != S_OK) break; - type = 0xdeadbeef; - memset( &val, 0, sizeof(val) ); - hr = IWbemClassObject_Get( obj, deviceidW, 0, &val, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "deviceid %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); + check_property( obj, attributesW, VT_I4, CIM_UINT32 ); + check_property( obj, deviceidW, VT_BSTR, CIM_STRING ); + check_property( obj, horizontalresolutionW, VT_I4, CIM_UINT32 ); type = 0xdeadbeef; memset( &val, 0, sizeof(val) ); @@ -1787,15 +1598,7 @@ static void test_Win32_Printer( IWbemServices *services ) trace( "location %s\n", wine_dbgstr_w(V_BSTR( &val )) ); VariantClear( &val ); - type = 0xdeadbeef; - memset( &val, 0, sizeof(val) ); - hr = IWbemClassObject_Get( obj, portnameW, 0, &val, &type, NULL ); - ok( hr == S_OK, "got %08x\n", hr ); - ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); - ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); - trace( "portname %s\n", wine_dbgstr_w(V_BSTR( &val )) ); - VariantClear( &val ); - + check_property( obj, portnameW, VT_BSTR, CIM_STRING ); IWbemClassObject_Release( obj ); } @@ -1847,6 +1650,7 @@ static void test_Win32_PnPEntity( IWbemServices *services ) VariantClear( &val ); } } + IWbemClassObject_Release( obj ); } SysFreeString( bstr ); @@ -1854,6 +1658,144 @@ static void test_Win32_PnPEntity( IWbemServices *services ) IEnumWbemClassObject_Release( enm ); } +static void test_Win32_WinSAT( IWbemServices *services ) +{ + static const WCHAR cpuscoreW[] = + {'C','P','U','S','c','o','r','e',0}; + static const WCHAR d3dscoreW[] = + {'D','3','D','S','c','o','r','e',0}; + static const WCHAR diskscoreW[] = + {'D','i','s','k','S','c','o','r','e',0}; + static const WCHAR graphicsscoreW[] = + {'G','r','a','p','h','i','c','s','S','c','o','r','e',0}; + static const WCHAR memoryscoreW[] = + {'M','e','m','o','r','y','S','c','o','r','e',0}; + static const WCHAR winsatassessmentstateW[] = + {'W','i','n','S','A','T','A','s','s','e','s','s','m','e','n','t','S','t','a','t','e',0}; + static const WCHAR winsprlevelW[] = + {'W','i','n','S','P','R','L','e','v','e','l',0}; + static const WCHAR queryW[] = + {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_','W','i','n','S','A','T',0}; + BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); + IEnumWbemClassObject *result; + IWbemClassObject *obj; + HRESULT hr; + DWORD count; + + hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result ); + ok( hr == S_OK || broken(hr == WBEM_E_INVALID_CLASS) /* win2k8 */, "got %08x\n", hr ); + if (hr == WBEM_E_INVALID_CLASS) + { + win_skip( "class not found\n" ); + return; + } + + for (;;) + { + hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); + if (hr != S_OK) break; + + check_property( obj, cpuscoreW, VT_R4, CIM_REAL32 ); + check_property( obj, d3dscoreW, VT_R4, CIM_REAL32 ); + check_property( obj, diskscoreW, VT_R4, CIM_REAL32 ); + check_property( obj, graphicsscoreW, VT_R4, CIM_REAL32 ); + check_property( obj, memoryscoreW, VT_R4, CIM_REAL32 ); + check_property( obj, winsatassessmentstateW, VT_I4, CIM_UINT32 ); + check_property( obj, winsprlevelW, VT_R4, CIM_REAL32 ); + IWbemClassObject_Release( obj ); + } + + IEnumWbemClassObject_Release( result ); + SysFreeString( query ); + SysFreeString( wql ); +} + +static void test_Win32_DisplayControllerConfiguration( IWbemServices *services ) +{ + static const WCHAR bitsperpixelW[] = + {'B','i','t','s','P','e','r','P','i','x','e','l',0}; + static const WCHAR captionW[] = + {'C','a','p','t','i','o','n',0}; + static const WCHAR horizontalresolutionW[] = + {'H','o','r','i','z','o','n','t','a','l','R','e','s','o','l','u','t','i','o','n',0}; + static const WCHAR nameW[] = + {'N','a','m','e',0}; + static const WCHAR queryW[] = + {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', + 'D','i','s','p','l','a','y','C','o','n','t','r','o','l','l','e','r', + 'C','o','n','f','i','g','u','r','a','t','i','o','n',0}; + static const WCHAR verticalresolutionW[] = + {'V','e','r','t','i','c','a','l','R','e','s','o','l','u','t','i','o','n',0}; + BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); + IEnumWbemClassObject *result; + IWbemClassObject *obj; + HRESULT hr; + DWORD count; + + hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result ); + ok( hr == S_OK, "got %08x\n", hr ); + + for (;;) + { + hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); + if (hr != S_OK) break; + + check_property( obj, bitsperpixelW, VT_I4, CIM_UINT32 ); + check_property( obj, captionW, VT_BSTR, CIM_STRING ); + check_property( obj, horizontalresolutionW, VT_I4, CIM_UINT32 ); + check_property( obj, nameW, VT_BSTR, CIM_STRING ); + check_property( obj, verticalresolutionW, VT_I4, CIM_UINT32 ); + IWbemClassObject_Release( obj ); + } + + IEnumWbemClassObject_Release( result ); + SysFreeString( query ); + SysFreeString( wql ); +} + +static void test_Win32_QuickFixEngineering( IWbemServices *services ) +{ + static const WCHAR captionW[] = + {'C','a','p','t','i','o','n',0}; + static const WCHAR hotfixidW[] = + {'H','o','t','F','i','x','I','D',0}; + static const WCHAR queryW[] = + {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', + 'Q','u','i','c','k','F','i','x','E','n','g','i','n','e','e','r','i','n','g',0}; + BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); + IEnumWbemClassObject *result; + IWbemClassObject *obj; + HRESULT hr; + DWORD count, total = 0; + VARIANT caption; + CIMTYPE type; + + hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result ); + ok( hr == S_OK, "got %08x\n", hr ); + + for (;;) + { + hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); + if (hr != S_OK) break; + + type = 0xdeadbeef; + VariantInit( &caption ); + hr = IWbemClassObject_Get( obj, captionW, 0, &caption, &type, NULL ); + ok( hr == S_OK, "failed to get caption %08x\n", hr ); + ok( V_VT( &caption ) == VT_BSTR || V_VT( &caption ) == VT_NULL /* winxp */, + "unexpected variant type 0x%x\n", V_VT( &caption ) ); + ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); + + check_property( obj, hotfixidW, VT_BSTR, CIM_STRING ); + IWbemClassObject_Release( obj ); + if (total++ >= 10) break; + } + + IEnumWbemClassObject_Release( result ); + SysFreeString( query ); + SysFreeString( wql ); +} + START_TEST(query) { static const WCHAR cimv2W[] = {'R','O','O','T','\\','C','I','M','V','2',0}; @@ -1879,27 +1821,34 @@ START_TEST(query) RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE ); ok( hr == S_OK, "failed to set proxy blanket %08x\n", hr ); - test_select( services ); + test_GetNames( services ); test_associators( services ); - test_Win32_Bios( services ); - test_Win32_Process( services, FALSE ); - test_Win32_Process( services, TRUE ); - test_Win32_Service( services ); - test_Win32_ComputerSystem( services ); - test_Win32_SystemEnclosure( services ); - test_StdRegProv( services ); test_notification_query_async( services ); test_query_async( services ); - test_GetNames( services ); + test_query_semisync( services ); + test_select( services ); + + /* classes */ + test_StdRegProv( services ); test_SystemSecurity( services ); - test_Win32_OperatingSystem( services ); + test_Win32_Baseboard( services ); + test_Win32_ComputerSystem( services ); test_Win32_ComputerSystemProduct( services ); - test_Win32_PhysicalMemory( services ); + test_Win32_Bios( services ); + test_Win32_DisplayControllerConfiguration( services ); test_Win32_IP4RouteTable( services ); + test_Win32_OperatingSystem( services ); + test_Win32_PhysicalMemory( services ); + test_Win32_PnPEntity( services ); + test_Win32_Printer( services ); + test_Win32_Process( services, FALSE ); + test_Win32_Process( services, TRUE ); test_Win32_Processor( services ); + test_Win32_QuickFixEngineering( services ); + test_Win32_Service( services ); + test_Win32_SystemEnclosure( services ); test_Win32_VideoController( services ); - test_Win32_Printer( services ); - test_Win32_PnPEntity( services ); + test_Win32_WinSAT( services ); SysFreeString( path ); IWbemServices_Release( services );
1
0
0
0
[reactos] 01/01: [WBEMPROX] Sync with Wine Staging 4.18. CORE-16441
by Amine Khaldi
01 Dec '19
01 Dec '19
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=628f4c996cc4a80294369…
commit 628f4c996cc4a80294369e10ef07e02e6607e248 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sun Dec 1 19:45:00 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Dec 1 19:45:00 2019 +0100 [WBEMPROX] Sync with Wine Staging 4.18. CORE-16441 --- dll/win32/wbemprox/builtin.c | 1708 ++++++++++++++++++++++++++------- dll/win32/wbemprox/class.c | 89 +- dll/win32/wbemprox/main.c | 2 - dll/win32/wbemprox/precomp.h | 2 - dll/win32/wbemprox/process.c | 1 - dll/win32/wbemprox/qualifier.c | 73 +- dll/win32/wbemprox/query.c | 702 ++++++++++---- dll/win32/wbemprox/reg.c | 1 - dll/win32/wbemprox/security.c | 1 - dll/win32/wbemprox/service.c | 1 - dll/win32/wbemprox/services.c | 68 +- dll/win32/wbemprox/table.c | 31 +- dll/win32/wbemprox/wbemlocator.c | 17 +- dll/win32/wbemprox/wbemprox_private.h | 66 +- dll/win32/wbemprox/wql.tab.c | 827 +++++++++------- dll/win32/wbemprox/wql.tab.h | 43 +- dll/win32/wbemprox/wql.y | 182 +++- media/doc/README.WINE | 2 +- 18 files changed, 2756 insertions(+), 1060 deletions(-) diff --git a/dll/win32/wbemprox/builtin.c b/dll/win32/wbemprox/builtin.c index 5f689635cf0..b92231c8152 100644 --- a/dll/win32/wbemprox/builtin.c +++ b/dll/win32/wbemprox/builtin.c @@ -20,32 +20,17 @@ #define NONAMELESSUNION #define NONAMELESSSTRUCT -#include "config.h" #include <stdarg.h> -#include <fcntl.h> -#ifdef HAVE_UNISTD_H -# include <unistd.h> -#endif -#ifdef HAVE_ARPA_INET_H -# include <arpa/inet.h> +#ifdef __REACTOS__ +#include <wchar.h> #endif #include "ntstatus.h" #define WIN32_NO_STATUS #include "windef.h" #include "winbase.h" -#ifdef __MINGW32__ -# include "winsock2.h" -# include "ws2tcpip.h" -# define WS_AF_INET AF_INET -# define WS_AF_UNSPEC AF_UNSPEC -# define WS_NI_MAXHOST NI_MAXHOST -# define WS_NI_NAMEREQD NI_NAMEREQD -#else -# define USE_WS_PREFIX -# include "winsock2.h" -# include "ws2tcpip.h" -#endif +#include "winsock2.h" +#include "ws2tcpip.h" #include "initguid.h" #include "wbemcli.h" #include "wbemprov.h" @@ -68,11 +53,14 @@ #include "winspool.h" #include "setupapi.h" +#include "wine/asm.h" #include "wine/debug.h" #include "wbemprox_private.h" WINE_DEFAULT_DEBUG_CHANNEL(wbemprox); +static const WCHAR class_associatorsW[] = + {'_','_','A','S','S','O','C','I','A','T','O','R','S',0}; static const WCHAR class_baseboardW[] = {'W','i','n','3','2','_','B','a','s','e','B','o','a','r','d',0}; static const WCHAR class_biosW[] = @@ -91,20 +79,27 @@ static const WCHAR class_directoryW[] = {'W','i','n','3','2','_','D','i','r','e','c','t','o','r','y',0}; static const WCHAR class_diskdriveW[] = {'W','i','n','3','2','_','D','i','s','k','D','r','i','v','e',0}; +static const WCHAR class_diskdrivetodiskpartitionW[] = + {'W','i','n','3','2','_','D','i','s','k','D','r','i','v','e','T','o','D','i','s','k','P','a','r','t','i','t','i','o','n',0}; static const WCHAR class_diskpartitionW[] = {'W','i','n','3','2','_','D','i','s','k','P','a','r','t','i','t','i','o','n',0}; +static const WCHAR class_displaycontrollerconfigW[] = + {'W','i','n','3','2','_','D','i','s','p','l','a','y','C','o','n','t','r','o','l','l','e','r', + 'C','o','n','f','i','g','u','r','a','t','i','o','n',0}; static const WCHAR class_ip4routetableW[] = {'W','i','n','3','2','_','I','P','4','R','o','u','t','e','T','a','b','l','e',0}; static const WCHAR class_logicaldiskW[] = {'W','i','n','3','2','_','L','o','g','i','c','a','l','D','i','s','k',0}; static const WCHAR class_logicaldisk2W[] = {'C','I','M','_','L','o','g','i','c','a','l','D','i','s','k',0}; +static const WCHAR class_logicaldisktopartitionW[] = + {'W','i','n','3','2','_','L','o','g','i','c','a','l','D','i','s','k','T','o','P','a','r','t','i','t','i','o','n',0}; static const WCHAR class_networkadapterW[] = {'W','i','n','3','2','_','N','e','t','w','o','r','k','A','d','a','p','t','e','r',0}; static const WCHAR class_networkadapterconfigW[] = {'W','i','n','3','2','_','N','e','t','w','o','r','k','A','d','a','p','t','e','r', 'C','o','n','f','i','g','u','r','a','t','i','o','n',0}; -static const WCHAR class_osW[] = +static const WCHAR class_operatingsystemW[] = {'W','i','n','3','2','_','O','p','e','r','a','t','i','n','g','S','y','s','t','e','m',0}; static const WCHAR class_paramsW[] = {'_','_','P','A','R','A','M','E','T','E','R','S',0}; @@ -125,6 +120,8 @@ static const WCHAR class_processor2W[] = {'C','I','M','_','P','r','o','c','e','s','s','o','r',0}; static const WCHAR class_qualifiersW[] = {'_','_','Q','U','A','L','I','F','I','E','R','S',0}; +static const WCHAR class_quickfixengineeringW[] = + {'W','i','n','3','2','_','Q','u','i','c','k','F','i','x','E','n','g','i','n','e','e','r','i','n','g',0}; static const WCHAR class_sidW[] = {'W','i','n','3','2','_','S','I','D',0}; static const WCHAR class_sounddeviceW[] = @@ -135,6 +132,8 @@ static const WCHAR class_systemenclosureW[] = static const WCHAR class_videocontrollerW[] = {'W','i','n','3','2','_','V','i','d','e','o','C','o','n','t','r','o','l','l','e','r',0}; #endif +static const WCHAR class_winsatW[] = + {'W','i','n','3','2','_','W','i','n','S','A','T',0}; static const WCHAR prop_accountnameW[] = {'A','c','c','o','u','n','t','N','a','m','e',0}; @@ -152,10 +151,18 @@ static const WCHAR prop_adapterramW[] = #endif static const WCHAR prop_adaptertypeW[] = {'A','d','a','p','t','e','r','T','y','p','e',0}; +static const WCHAR prop_adaptertypeidW[] = + {'A','d','a','p','t','e','r','T','y','p','e','I','D',0}; static const WCHAR prop_addresswidthW[] = {'A','d','d','r','e','s','s','W','i','d','t','h',0}; +static const WCHAR prop_antecedentW[] = + {'A','n','t','e','c','e','d','e','n','t',0}; static const WCHAR prop_architectureW[] = {'A','r','c','h','i','t','e','c','t','u','r','e',0}; +static const WCHAR prop_assocclassW[] = + {'A','s','s','o','c','C','l','a','s','s',0}; +static const WCHAR prop_associatorW[] = + {'A','s','s','o','c','i','a','t','o','r',0}; static const WCHAR prop_attributesW[] = {'A','t','t','r','i','b','u','t','e','s',0}; #ifndef __REACTOS__ @@ -164,6 +171,10 @@ static const WCHAR prop_availabilityW[] = #endif static const WCHAR prop_binaryrepresentationW[] = {'B','i','n','a','r','y','R','e','p','r','e','s','e','n','t','a','t','i','o','n',0}; +static const WCHAR prop_bitsperpixelW[] = + {'B','i','t','s','P','e','r','P','i','x','e','l',0}; +static const WCHAR prop_boolvalueW[] = + {'B','o','o','l','V','a','l','u','e',0}; static const WCHAR prop_bootableW[] = {'B','o','o','t','a','b','l','e',0}; static const WCHAR prop_bootpartitionW[] = @@ -184,44 +195,60 @@ static const WCHAR prop_commandlineW[] = {'C','o','m','m','a','n','d','L','i','n','e',0}; static const WCHAR prop_configmanagererrorcodeW[] = {'C','o','n','f','i','g','M','a','n','a','g','e','r','E','r','r','o','r','C','o','d','e',0}; +static const WCHAR prop_configuredclockspeedW[] = + {'C','o','n','f','i','g','u','r','e','d','C','l','o','c','k','S','p','e','e','d',0}; static const WCHAR prop_countrycodeW[] = {'C','o','u','n','t','r','y','C','o','d','e',0}; +static const WCHAR prop_cpuscoreW[] = + {'C','P','U','S','c','o','r','e',0}; static const WCHAR prop_cpustatusW[] = {'C','p','u','S','t','a','t','u','s',0}; static const WCHAR prop_csdversionW[] = {'C','S','D','V','e','r','s','i','o','n',0}; +static const WCHAR prop_csnameW[] = + {'C','S','N','a','m','e',0}; #ifndef __REACTOS__ static const WCHAR prop_currentbitsperpixelW[] = {'C','u','r','r','e','n','t','B','i','t','s','P','e','r','P','i','x','e','l',0}; #endif static const WCHAR prop_currentclockspeedW[] = {'C','u','r','r','e','n','t','C','l','o','c','k','S','p','e','e','d',0}; -#ifndef __REACTOS__ static const WCHAR prop_currenthorizontalresW[] = {'C','u','r','r','e','n','t','H','o','r','i','z','o','n','t','a','l','R','e','s','o','l','u','t','i','o','n',0}; +static const WCHAR prop_currentlanguageW[] = + {'C','u','r','r','e','n','t','L','a','n','g','u','a','g','e',0}; static const WCHAR prop_currentrefreshrateW[] = {'C','u','r','r','e','n','t','R','e','f','r','e','s','h','R','a','t','e',0}; static const WCHAR prop_currentscanmodeW[] = {'C','u','r','r','e','n','t','S','c','a','n','M','o','d','e',0}; +static const WCHAR prop_currenttimezoneW[] = + {'C','u','r','r','e','n','t','T','i','m','e','Z','o','n','e',0}; static const WCHAR prop_currentverticalresW[] = {'C','u','r','r','e','n','t','V','e','r','t','i','c','a','l','R','e','s','o','l','u','t','i','o','n',0}; -#endif +static const WCHAR prop_d3dscoreW[] = + {'D','3','D','S','c','o','r','e',0}; static const WCHAR prop_datawidthW[] = {'D','a','t','a','W','i','d','t','h',0}; static const WCHAR prop_defaultipgatewayW[] = {'D','e','f','a','u','l','t','I','P','G','a','t','e','w','a','y',0}; static const WCHAR prop_defaultvalueW[] = {'D','e','f','a','u','l','t','V','a','l','u','e',0}; +static const WCHAR prop_dependentW[] = + {'D','e','p','e','n','d','e','n','t',0}; static const WCHAR prop_descriptionW[] = {'D','e','s','c','r','i','p','t','i','o','n',0}; static const WCHAR prop_destinationW[] = {'D','e','s','t','i','n','a','t','i','o','n',0}; static const WCHAR prop_deviceidW[] = {'D','e','v','i','c','e','I','d',0}; +static const WCHAR prop_devicelocatorW[] = + {'D','e','v','i','c','e','L','o','c','a','t','o','r',0}; static const WCHAR prop_dhcpenabledW[] = {'D','H','C','P','E','n','a','b','l','e','d',0}; static const WCHAR prop_directionW[] = {'D','i','r','e','c','t','i','o','n',0}; +static const WCHAR prop_diskscoreW[] = + {'D','i','s','k','S','c','o','r','e',0}; static const WCHAR prop_displaynameW[] = {'D','i','s','p','l','a','y','N','a','m','e',0}; static const WCHAR prop_diskindexW[] = @@ -258,8 +285,12 @@ static const WCHAR prop_freephysicalmemoryW[] = {'F','r','e','e','P','h','y','s','i','c','a','l','M','e','m','o','r','y',0}; static const WCHAR prop_handleW[] = {'H','a','n','d','l','e',0}; +static const WCHAR prop_graphicsscoreW[] = + {'G','r','a','p','h','i','c','s','S','c','o','r','e',0}; static const WCHAR prop_horizontalresolutionW[] = {'H','o','r','i','z','o','n','t','a','l','R','e','s','o','l','u','t','i','o','n',0}; +static const WCHAR prop_hotfixidW[] = + {'H','o','t','F','i','x','I','D',0}; static const WCHAR prop_idW[] = {'I','D',0}; static const WCHAR prop_identificationcodeW[] = @@ -310,6 +341,8 @@ static const WCHAR prop_mediatypeW[] = {'M','e','d','i','a','T','y','p','e',0}; static const WCHAR prop_memberW[] = {'M','e','m','b','e','r',0}; +static const WCHAR prop_memoryscoreW[] = + {'M','e','m','o','r','y','S','c','o','r','e',0}; static const WCHAR prop_memorytypeW[] = {'M','e','m','o','r','y','T','y','p','e',0}; static const WCHAR prop_methodW[] = @@ -328,6 +361,8 @@ static const WCHAR prop_numlogicalprocessorsW[] = {'N','u','m','b','e','r','O','f','L','o','g','i','c','a','l','P','r','o','c','e','s','s','o','r','s',0}; static const WCHAR prop_numprocessorsW[] = {'N','u','m','b','e','r','O','f','P','r','o','c','e','s','s','o','r','s',0}; +static const WCHAR prop_operatingsystemskuW[] = + {'O','p','e','r','a','t','i','n','g','S','y','s','t','e','m','S','K','U',0}; static const WCHAR prop_osarchitectureW[] = {'O','S','A','r','c','h','i','t','e','c','t','u','r','e',0}; static const WCHAR prop_oslanguageW[] = @@ -338,6 +373,8 @@ static const WCHAR prop_ostypeW[] = {'O','S','T','y','p','e',0}; static const WCHAR prop_parameterW[] = {'P','a','r','a','m','e','t','e','r',0}; +static const WCHAR prop_partnumberW[] = + {'P','a','r','t','N','u','m','b','e','r',0}; static const WCHAR prop_physicaladapterW[] = {'P','h','y','s','i','c','a','l','A','d','a','p','t','e','r',0}; static const WCHAR prop_pixelsperxlogicalinchW[] = @@ -408,12 +445,16 @@ static const WCHAR prop_suitemaskW[] = {'S','u','i','t','e','M','a','s','k',0}; static const WCHAR prop_systemdirectoryW[] = {'S','y','s','t','e','m','D','i','r','e','c','t','o','r','y',0}; +static const WCHAR prop_systemdriveW[] = + {'S','y','s','t','e','m','D','r','i','v','e',0}; static const WCHAR prop_systemnameW[] = {'S','y','s','t','e','m','N','a','m','e',0}; static const WCHAR prop_tagW[] = {'T','a','g',0}; static const WCHAR prop_threadcountW[] = {'T','h','r','e','a','d','C','o','u','n','t',0}; +static const WCHAR prop_timetakenW[] = + {'T','i','m','e','T','a','k','e','n',0}; static const WCHAR prop_totalphysicalmemoryW[] = {'T','o','t','a','l','P','h','y','s','i','c','a','l','M','e','m','o','r','y',0}; static const WCHAR prop_totalvirtualmemorysizeW[] = @@ -428,12 +469,12 @@ static const WCHAR prop_usernameW[] = {'U','s','e','r','N','a','m','e',0}; static const WCHAR prop_uuidW[] = {'U','U','I','D',0}; -static const WCHAR prop_varianttypeW[] = - {'V','a','r','i','a','n','t','T','y','p','e',0}; static const WCHAR prop_vendorW[] = {'V','e','n','d','o','r',0}; static const WCHAR prop_versionW[] = {'V','e','r','s','i','o','n',0}; +static const WCHAR prop_verticalresolutionW[] = + {'V','e','r','t','i','c','a','l','R','e','s','o','l','u','t','i','o','n',0}; #ifndef __REACTOS__ static const WCHAR prop_videoarchitectureW[] = {'V','i','d','e','o','A','r','c','h','i','t','e','c','t','u','r','e',0}; @@ -448,31 +489,42 @@ static const WCHAR prop_volumenameW[] = {'V','o','l','u','m','e','N','a','m','e',0}; static const WCHAR prop_volumeserialnumberW[] = {'V','o','l','u','m','e','S','e','r','i','a','l','N','u','m','b','e','r',0}; +static const WCHAR prop_winsatassessmentstateW[] = + {'W','i','n','S','A','T','A','s','s','e','s','s','m','e','n','t','S','t','a','t','e',0}; +static const WCHAR prop_winsprlevelW[] = + {'W','i','n','S','P','R','L','e','v','e','l',0}; static const WCHAR prop_workingsetsizeW[] = {'W','o','r','k','i','n','g','S','e','t','S','i','z','e',0}; /* column definitions must be kept in sync with record structures below */ +static const struct column col_associator[] = +{ + { prop_assocclassW, CIM_STRING }, + { prop_classW, CIM_STRING }, + { prop_associatorW, CIM_STRING } +}; static const struct column col_baseboard[] = { - { prop_manufacturerW, CIM_STRING }, + { prop_manufacturerW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_modelW, CIM_STRING }, { prop_nameW, CIM_STRING }, - { prop_productW, CIM_STRING }, - { prop_serialnumberW, CIM_STRING }, + { prop_productW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_serialnumberW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_tagW, CIM_STRING|COL_FLAG_KEY }, - { prop_versionW, CIM_STRING } + { prop_versionW, CIM_STRING|COL_FLAG_DYNAMIC } }; static const struct column col_bios[] = { + { prop_currentlanguageW, CIM_STRING }, { prop_descriptionW, CIM_STRING }, { prop_identificationcodeW, CIM_STRING }, - { prop_manufacturerW, CIM_STRING }, + { prop_manufacturerW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_nameW, CIM_STRING }, - { prop_releasedateW, CIM_DATETIME }, + { prop_releasedateW, CIM_DATETIME|COL_FLAG_DYNAMIC }, { prop_serialnumberW, CIM_STRING }, - { prop_smbiosbiosversionW, CIM_STRING }, - { prop_smbiosmajorversionW, CIM_UINT16, VT_I4 }, - { prop_smbiosminorversionW, CIM_UINT16, VT_I4 }, + { prop_smbiosbiosversionW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_smbiosmajorversionW, CIM_UINT16 }, + { prop_smbiosminorversionW, CIM_UINT16 }, { prop_versionW, CIM_STRING|COL_FLAG_KEY } }; static const struct column col_cdromdrive[] = @@ -487,23 +539,23 @@ static const struct column col_compsys[] = { { prop_descriptionW, CIM_STRING }, { prop_domainW, CIM_STRING }, - { prop_domainroleW, CIM_UINT16, VT_I4 }, + { prop_domainroleW, CIM_UINT16 }, { prop_manufacturerW, CIM_STRING }, { prop_modelW, CIM_STRING }, { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC }, - { prop_numlogicalprocessorsW, CIM_UINT32, VT_I4 }, - { prop_numprocessorsW, CIM_UINT32, VT_I4 }, + { prop_numlogicalprocessorsW, CIM_UINT32 }, + { prop_numprocessorsW, CIM_UINT32 }, { prop_totalphysicalmemoryW, CIM_UINT64 }, { prop_usernameW, CIM_STRING|COL_FLAG_DYNAMIC } }; static const struct column col_compsysproduct[] = { - { prop_identifyingnumberW, CIM_STRING|COL_FLAG_KEY }, - { prop_nameW, CIM_STRING|COL_FLAG_KEY }, + { prop_identifyingnumberW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY }, + { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY }, { prop_skunumberW, CIM_STRING }, { prop_uuidW, CIM_STRING|COL_FLAG_DYNAMIC }, - { prop_vendorW, CIM_STRING }, - { prop_versionW, CIM_STRING|COL_FLAG_KEY } + { prop_vendorW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_versionW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY } }; static const struct column col_datafile[] = { @@ -522,7 +574,7 @@ static const struct column col_directory[] = static const struct column col_diskdrive[] = { { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY }, - { prop_indexW, CIM_UINT32, VT_I4 }, + { prop_indexW, CIM_UINT32 }, { prop_interfacetypeW, CIM_STRING }, { prop_manufacturerW, CIM_STRING }, { prop_mediatypeW, CIM_STRING }, @@ -531,18 +583,31 @@ static const struct column col_diskdrive[] = { prop_serialnumberW, CIM_STRING }, { prop_sizeW, CIM_UINT64 } }; +static const struct column col_diskdrivetodiskpartition[] = +{ + { prop_antecedentW, CIM_REFERENCE|COL_FLAG_DYNAMIC|COL_FLAG_KEY }, + { prop_dependentW, CIM_REFERENCE|COL_FLAG_DYNAMIC|COL_FLAG_KEY } +}; static const struct column col_diskpartition[] = { { prop_bootableW, CIM_BOOLEAN }, { prop_bootpartitionW, CIM_BOOLEAN }, { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY }, - { prop_diskindexW, CIM_UINT32, VT_I4 }, - { prop_indexW, CIM_UINT32, VT_I4 }, + { prop_diskindexW, CIM_UINT32 }, + { prop_indexW, CIM_UINT32 }, { prop_pnpdeviceidW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_sizeW, CIM_UINT64 }, { prop_startingoffsetW, CIM_UINT64 }, { prop_typeW, CIM_STRING|COL_FLAG_DYNAMIC } }; +static const struct column col_displaycontrollerconfig[] = +{ + { prop_bitsperpixelW, CIM_UINT32 }, + { prop_captionW, CIM_STRING }, + { prop_horizontalresolutionW, CIM_UINT32 }, + { prop_nameW, CIM_STRING|COL_FLAG_KEY }, + { prop_verticalresolutionW, CIM_UINT32 } +}; static const struct column col_ip4routetable[] = { { prop_destinationW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY }, @@ -552,7 +617,7 @@ static const struct column col_ip4routetable[] = static const struct column col_logicaldisk[] = { { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY }, - { prop_drivetypeW, CIM_UINT32, VT_I4 }, + { prop_drivetypeW, CIM_UINT32 }, { prop_filesystemW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_freespaceW, CIM_UINT64 }, { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC }, @@ -560,16 +625,23 @@ static const struct column col_logicaldisk[] = { prop_volumenameW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_volumeserialnumberW, CIM_STRING|COL_FLAG_DYNAMIC } }; +static const struct column col_logicaldisktopartition[] = +{ + { prop_antecedentW, CIM_REFERENCE|COL_FLAG_DYNAMIC|COL_FLAG_KEY }, + { prop_dependentW, CIM_REFERENCE|COL_FLAG_DYNAMIC|COL_FLAG_KEY } +}; static const struct column col_networkadapter[] = { { prop_adaptertypeW, CIM_STRING }, + { prop_adaptertypeidW, CIM_UINT16 }, + { prop_descriptionW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY }, - { prop_indexW, CIM_UINT32, VT_I4 }, - { prop_interfaceindexW, CIM_UINT32, VT_I4 }, + { prop_indexW, CIM_UINT32 }, + { prop_interfaceindexW, CIM_UINT32 }, { prop_macaddressW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_manufacturerW, CIM_STRING }, { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC }, - { prop_netconnectionstatusW, CIM_UINT16, VT_I4 }, + { prop_netconnectionstatusW, CIM_UINT16 }, { prop_physicaladapterW, CIM_BOOLEAN }, { prop_pnpdeviceidW, CIM_STRING }, { prop_speedW, CIM_UINT64 } @@ -581,37 +653,42 @@ static const struct column col_networkadapterconfig[] = { prop_dhcpenabledW, CIM_BOOLEAN }, { prop_dnshostnameW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_dnsserversearchorderW, CIM_STRING|CIM_FLAG_ARRAY|COL_FLAG_DYNAMIC }, - { prop_indexW, CIM_UINT32|COL_FLAG_KEY, VT_I4 }, + { prop_indexW, CIM_UINT32|COL_FLAG_KEY }, { prop_ipaddressW, CIM_STRING|CIM_FLAG_ARRAY|COL_FLAG_DYNAMIC }, - { prop_ipconnectionmetricW, CIM_UINT32, VT_I4 }, + { prop_ipconnectionmetricW, CIM_UINT32 }, { prop_ipenabledW, CIM_BOOLEAN }, { prop_ipsubnet, CIM_STRING|CIM_FLAG_ARRAY|COL_FLAG_DYNAMIC }, { prop_macaddressW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_settingidW, CIM_STRING|COL_FLAG_DYNAMIC } }; -static const struct column col_os[] = +static const struct column col_operatingsystem[] = { { prop_buildnumberW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_captionW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_codesetW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_countrycodeW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_csdversionW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_csnameW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_currenttimezoneW, CIM_SINT16 }, { prop_freephysicalmemoryW, CIM_UINT64 }, { prop_installdateW, CIM_DATETIME }, { prop_lastbootuptimeW, CIM_DATETIME|COL_FLAG_DYNAMIC }, { prop_localdatetimeW, CIM_DATETIME|COL_FLAG_DYNAMIC }, { prop_localeW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_manufacturerW, CIM_STRING }, { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_operatingsystemskuW, CIM_UINT32 }, { prop_osarchitectureW, CIM_STRING }, - { prop_oslanguageW, CIM_UINT32, VT_I4 }, - { prop_osproductsuiteW, CIM_UINT32, VT_I4 }, - { prop_ostypeW, CIM_UINT16, VT_I4 }, + { prop_oslanguageW, CIM_UINT32 }, + { prop_osproductsuiteW, CIM_UINT32 }, + { prop_ostypeW, CIM_UINT16 }, { prop_primaryW, CIM_BOOLEAN }, { prop_serialnumberW, CIM_STRING }, - { prop_servicepackmajorW, CIM_UINT16, VT_I4 }, - { prop_servicepackminorW, CIM_UINT16, VT_I4 }, - { prop_suitemaskW, CIM_UINT32, VT_I4 }, + { prop_servicepackmajorW, CIM_UINT16 }, + { prop_servicepackminorW, CIM_UINT16 }, + { prop_suitemaskW, CIM_UINT32 }, { prop_systemdirectoryW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_systemdriveW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_totalvirtualmemorysizeW, CIM_UINT64 }, { prop_totalvisiblememorysizeW, CIM_UINT64 }, { prop_versionW, CIM_STRING|COL_FLAG_DYNAMIC } @@ -623,7 +700,6 @@ static const struct column col_param[] = { prop_directionW, CIM_SINT32 }, { prop_parameterW, CIM_STRING }, { prop_typeW, CIM_UINT32 }, - { prop_varianttypeW, CIM_UINT32 }, { prop_defaultvalueW, CIM_UINT32 } }; static const struct column col_physicalmedia[] = @@ -633,8 +709,11 @@ static const struct column col_physicalmedia[] = }; static const struct column col_physicalmemory[] = { - { prop_capacityW, CIM_UINT64 }, - { prop_memorytypeW, CIM_UINT16, VT_I4 } + { prop_capacityW, CIM_UINT64 }, + { prop_configuredclockspeedW, CIM_UINT32 }, + { prop_devicelocatorW, CIM_STRING }, + { prop_memorytypeW, CIM_UINT16 }, + { prop_partnumberW, CIM_STRING } }; static const struct column col_pnpentity[] = { @@ -659,45 +738,51 @@ static const struct column col_process[] = { prop_descriptionW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_handleW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY }, { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC }, - { prop_pprocessidW, CIM_UINT32, VT_I4 }, - { prop_processidW, CIM_UINT32, VT_I4 }, - { prop_threadcountW, CIM_UINT32, VT_I4 }, + { prop_pprocessidW, CIM_UINT32 }, + { prop_processidW, CIM_UINT32 }, + { prop_threadcountW, CIM_UINT32 }, { prop_workingsetsizeW, CIM_UINT64 }, /* methods */ { method_getownerW, CIM_FLAG_ARRAY|COL_FLAG_METHOD } }; static const struct column col_processor[] = { - { prop_addresswidthW, CIM_UINT16, VT_I4 }, - { prop_architectureW, CIM_UINT16, VT_I4 }, + { prop_addresswidthW, CIM_UINT16 }, + { prop_architectureW, CIM_UINT16 }, { prop_captionW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_cpustatusW, CIM_UINT16 }, - { prop_currentclockspeedW, CIM_UINT32, VT_I4 }, - { prop_datawidthW, CIM_UINT16, VT_I4 }, + { prop_currentclockspeedW, CIM_UINT32 }, + { prop_datawidthW, CIM_UINT16 }, { prop_descriptionW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY }, - { prop_familyW, CIM_UINT16, VT_I4 }, - { prop_levelW, CIM_UINT16, VT_I4 }, + { prop_familyW, CIM_UINT16 }, + { prop_levelW, CIM_UINT16 }, { prop_manufacturerW, CIM_STRING|COL_FLAG_DYNAMIC }, - { prop_maxclockspeedW, CIM_UINT32, VT_I4 }, + { prop_maxclockspeedW, CIM_UINT32 }, { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC }, - { prop_numcoresW, CIM_UINT32, VT_I4 }, - { prop_numlogicalprocessorsW, CIM_UINT32, VT_I4 }, + { prop_numcoresW, CIM_UINT32 }, + { prop_numlogicalprocessorsW, CIM_UINT32 }, { prop_processoridW, CIM_STRING|COL_FLAG_DYNAMIC }, - { prop_processortypeW, CIM_UINT16, VT_I4 }, - { prop_revisionW, CIM_UINT16, VT_I4 }, + { prop_processortypeW, CIM_UINT16 }, + { prop_revisionW, CIM_UINT16 }, { prop_uniqueidW, CIM_STRING }, { prop_versionW, CIM_STRING|COL_FLAG_DYNAMIC } }; static const struct column col_qualifier[] = { - { prop_classW, CIM_STRING }, - { prop_memberW, CIM_STRING }, - { prop_typeW, CIM_UINT32 }, - { prop_flavorW, CIM_SINT32 }, - { prop_nameW, CIM_STRING }, - { prop_intvalueW, CIM_SINT32 }, - { prop_strvalueW, CIM_STRING } + { prop_classW, CIM_STRING }, + { prop_memberW, CIM_STRING }, + { prop_typeW, CIM_UINT32 }, + { prop_flavorW, CIM_SINT32 }, + { prop_nameW, CIM_STRING }, + { prop_intvalueW, CIM_SINT32 }, + { prop_strvalueW, CIM_STRING }, + { prop_boolvalueW, CIM_BOOLEAN } +}; +static const struct column col_quickfixengineering[] = +{ + { prop_captionW, CIM_STRING }, + { prop_hotfixidW, CIM_STRING|COL_FLAG_KEY } }; static const struct column col_service[] = { @@ -728,7 +813,7 @@ static const struct column col_sounddevice[] = { { prop_nameW, CIM_STRING }, { prop_productnameW, CIM_STRING }, - { prop_statusinfoW, CIM_UINT16, VT_I4 } + { prop_statusinfoW, CIM_UINT16 } }; static const struct column col_stdregprov[] = { @@ -740,10 +825,10 @@ static const struct column col_stdregprov[] = static const struct column col_systemenclosure[] = { { prop_captionW, CIM_STRING }, - { prop_chassistypesW, CIM_UINT16|CIM_FLAG_ARRAY, VT_I4|VT_ARRAY }, + { prop_chassistypesW, CIM_UINT16|CIM_FLAG_ARRAY|COL_FLAG_DYNAMIC }, { prop_descriptionW, CIM_STRING }, { prop_lockpresentW, CIM_BOOLEAN }, - { prop_manufacturerW, CIM_STRING }, + { prop_manufacturerW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_nameW, CIM_STRING }, { prop_tagW, CIM_STRING }, }; @@ -757,15 +842,15 @@ static const struct column col_systemsecurity[] = static const struct column col_videocontroller[] = { { prop_adapterdactypeW, CIM_STRING }, - { prop_adapterramW, CIM_UINT32, VT_I4 }, + { prop_adapterramW, CIM_UINT32 }, { prop_availabilityW, CIM_UINT16 }, { prop_captionW, CIM_STRING|COL_FLAG_DYNAMIC }, - { prop_configmanagererrorcodeW, CIM_UINT32, VT_I4 }, - { prop_currentbitsperpixelW, CIM_UINT32, VT_I4 }, - { prop_currenthorizontalresW, CIM_UINT32, VT_I4 }, - { prop_currentrefreshrateW, CIM_UINT32, VT_I4 }, - { prop_currentscanmodeW, CIM_UINT16, VT_I4 }, - { prop_currentverticalresW, CIM_UINT32, VT_I4 }, + { prop_configmanagererrorcodeW, CIM_UINT32 }, + { prop_currentbitsperpixelW, CIM_UINT32 }, + { prop_currenthorizontalresW, CIM_UINT32 }, + { prop_currentrefreshrateW, CIM_UINT32 }, + { prop_currentscanmodeW, CIM_UINT16 }, + { prop_currentverticalresW, CIM_UINT32 }, { prop_descriptionW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_deviceidW, CIM_STRING|COL_FLAG_KEY }, { prop_driverdateW, CIM_DATETIME }, @@ -774,13 +859,26 @@ static const struct column col_videocontroller[] = { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_pnpdeviceidW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_statusW, CIM_STRING }, - { prop_videoarchitectureW, CIM_UINT16, VT_I4 }, - { prop_videomemorytypeW, CIM_UINT16, VT_I4 }, + { prop_videoarchitectureW, CIM_UINT16 }, + { prop_videomemorytypeW, CIM_UINT16 }, { prop_videomodedescriptionW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_videoprocessorW, CIM_STRING|COL_FLAG_DYNAMIC }, }; #endif +static const struct column col_winsat[] = +{ + { prop_cpuscoreW, CIM_REAL32 }, + { prop_d3dscoreW, CIM_REAL32 }, + { prop_diskscoreW, CIM_REAL32 }, + { prop_graphicsscoreW, CIM_REAL32 }, + { prop_memoryscoreW, CIM_REAL32 }, + { prop_timetakenW, CIM_STRING|COL_FLAG_KEY }, + { prop_winsatassessmentstateW, CIM_UINT32 }, + { prop_winsprlevelW, CIM_REAL32 }, +}; + + static const WCHAR baseboard_manufacturerW[] = {'I','n','t','e','l',' ','C','o','r','p','o','r','a','t','i','o','n',0}; static const WCHAR baseboard_serialnumberW[] = @@ -793,8 +891,6 @@ static const WCHAR bios_descriptionW[] = {'D','e','f','a','u','l','t',' ','S','y','s','t','e','m',' ','B','I','O','S',0}; static const WCHAR bios_manufacturerW[] = {'T','h','e',' ','W','i','n','e',' ','P','r','o','j','e','c','t',0}; -static const WCHAR bios_nameW[] = - {'W','I','N','E',' ','B','I','O','S',0}; static const WCHAR bios_releasedateW[] = {'2','0','1','2','0','6','0','8','0','0','0','0','0','0','.','0','0','0','0','0','0','+','0','0','0',0}; static const WCHAR bios_serialnumberW[] = @@ -859,6 +955,10 @@ static const WCHAR os_serialnumberW[] = {'1','2','3','4','5','-','O','E','M','-','1','2','3','4','5','6','7','-','1','2','3','4','5',0}; static const WCHAR physicalmedia_tagW[] = {'\\','\\','.','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','0',0}; +static const WCHAR quickfixengineering_captionW[] = + {'h','t','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g',0}; +static const WCHAR quickfixengineering_hotfixidW[] = + {'K','B','1','2','3','4','5','6','7',0}; static const WCHAR sounddevice_productnameW[] = {'W','i','n','e',' ','A','u','d','i','o',' ','D','e','v','i','c','e',0}; static const WCHAR systemenclosure_systemenclosureW[] = @@ -867,7 +967,6 @@ static const WCHAR systemenclosure_tagW[] = {'S','y','s','t','e','m',' ','E','n','c','l','o','s','u','r','e',' ','0',0}; static const WCHAR systemenclosure_manufacturerW[] = {'W','i','n','e',0}; -#ifndef __REACTOS__ static const WCHAR videocontroller_dactypeW[] = {'I','n','t','e','g','r','a','t','e','d',' ','R','A','M','D','A','C',0}; static const WCHAR videocontroller_deviceidW[] = @@ -878,9 +977,16 @@ static const WCHAR videocontroller_driverversionW[] = {'1','.','0',0}; static const WCHAR videocontroller_statusW[] = {'O','K',0}; -#endif +static const WCHAR winsat_timetakenW[] = + {'M','o','s','t','R','e','c','e','n','t','A','s','s','e','s','s','m','e','n','t',0}; #include "pshpack1.h" +struct record_associator +{ + const WCHAR *assocclass; + const WCHAR *class; + const WCHAR *associator; +}; struct record_baseboard { const WCHAR *manufacturer; @@ -893,6 +999,7 @@ struct record_baseboard }; struct record_bios { + const WCHAR *currentlanguage; const WCHAR *description; const WCHAR *identificationcode; const WCHAR *manufacturer; @@ -960,6 +1067,11 @@ struct record_diskdrive const WCHAR *serialnumber; UINT64 size; }; +struct record_diskdrivetodiskpartition +{ + const WCHAR *antecedent; + const WCHAR *dependent; +}; struct record_diskpartition { int bootable; @@ -972,6 +1084,14 @@ struct record_diskpartition UINT64 startingoffset; const WCHAR *type; }; +struct record_displaycontrollerconfig +{ + UINT32 bitsperpixel; + const WCHAR *caption; + UINT32 horizontalresolution; + const WCHAR *name; + UINT32 verticalresolution; +}; struct record_ip4routetable { const WCHAR *destination; @@ -989,9 +1109,16 @@ struct record_logicaldisk const WCHAR *volumename; const WCHAR *volumeserialnumber; }; +struct record_logicaldisktopartition +{ + const WCHAR *antecedent; + const WCHAR *dependent; +}; struct record_networkadapter { const WCHAR *adaptertype; + UINT16 adaptertypeid; + const WCHAR *description; const WCHAR *device_id; UINT32 index; UINT32 interface_index; @@ -1025,12 +1152,16 @@ struct record_operatingsystem const WCHAR *codeset; const WCHAR *countrycode; const WCHAR *csdversion; + const WCHAR *csname; + INT16 currenttimezone; UINT64 freephysicalmemory; const WCHAR *installdate; const WCHAR *lastbootuptime; const WCHAR *localdatetime; const WCHAR *locale; + const WCHAR *manufacturer; const WCHAR *name; + UINT32 operatingsystemsku; const WCHAR *osarchitecture; UINT32 oslanguage; UINT32 osproductsuite; @@ -1041,6 +1172,7 @@ struct record_operatingsystem UINT16 servicepackminor; UINT32 suitemask; const WCHAR *systemdirectory; + const WCHAR *systemdrive; UINT64 totalvirtualmemorysize; UINT64 totalvisiblememorysize; const WCHAR *version; @@ -1052,7 +1184,6 @@ struct record_param INT32 direction; const WCHAR *parameter; UINT32 type; - UINT32 varianttype; UINT32 defaultvalue; }; struct record_physicalmedia @@ -1062,8 +1193,11 @@ struct record_physicalmedia }; struct record_physicalmemory { - UINT64 capacity; - UINT16 memorytype; + UINT64 capacity; + UINT32 configuredclockspeed; + const WCHAR *devicelocator; + UINT16 memorytype; + const WCHAR *partnumber; }; struct record_pnpentity { @@ -1127,6 +1261,12 @@ struct record_qualifier const WCHAR *name; INT32 intvalue; const WCHAR *strvalue; + int boolvalue; +}; +struct record_quickfixengineering +{ + const WCHAR *caption; + const WCHAR *hotfixid; }; struct record_service { @@ -1173,13 +1313,13 @@ struct record_systemsecurity }; struct record_systemenclosure { - const WCHAR *caption; + const WCHAR *caption; const struct array *chassistypes; - const WCHAR *description; - int lockpresent; - const WCHAR *manufacturer; - const WCHAR *name; - const WCHAR *tag; + const WCHAR *description; + int lockpresent; + const WCHAR *manufacturer; + const WCHAR *name; + const WCHAR *tag; }; struct record_videocontroller { @@ -1206,47 +1346,54 @@ struct record_videocontroller const WCHAR *videomodedescription; const WCHAR *videoprocessor; }; +struct record_winsat +{ + FLOAT cpuscore; + FLOAT d3dscore; + FLOAT diskscrore; + FLOAT graphicsscore; + FLOAT memoryscore; + const WCHAR *timetaken; + UINT32 winsatassessmentstate; + FLOAT winsprlevel; +}; #include "poppack.h" -static const struct record_baseboard data_baseboard[] = -{ - { baseboard_manufacturerW, baseboard_tagW, baseboard_tagW, baseboard_tagW, baseboard_serialnumberW, baseboard_versionW } -}; -static const struct record_bios data_bios[] = +static const struct record_associator data_associator[] = { - { bios_descriptionW, NULL, bios_manufacturerW, bios_nameW, bios_releasedateW, bios_serialnumberW, - bios_smbiosbiosversionW, 1, 0, bios_versionW } + { class_diskdrivetodiskpartitionW, class_diskpartitionW, class_diskdriveW }, + { class_logicaldisktopartitionW, class_logicaldiskW, class_diskpartitionW }, }; static const struct record_param data_param[] = { - { class_processW, method_getownerW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, + { class_processW, method_getownerW, -1, param_returnvalueW, CIM_UINT32 }, { class_processW, method_getownerW, -1, param_userW, CIM_STRING }, { class_processW, method_getownerW, -1, param_domainW, CIM_STRING }, - { class_serviceW, method_pauseserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, - { class_serviceW, method_resumeserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, - { class_serviceW, method_startserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, - { class_serviceW, method_stopserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, - { class_stdregprovW, method_createkeyW, 1, param_defkeyW, CIM_SINT32, 0, 0x80000002 }, + { class_serviceW, method_pauseserviceW, -1, param_returnvalueW, CIM_UINT32 }, + { class_serviceW, method_resumeserviceW, -1, param_returnvalueW, CIM_UINT32 }, + { class_serviceW, method_startserviceW, -1, param_returnvalueW, CIM_UINT32 }, + { class_serviceW, method_stopserviceW, -1, param_returnvalueW, CIM_UINT32 }, + { class_stdregprovW, method_createkeyW, 1, param_defkeyW, CIM_SINT32, 0x80000002 }, { class_stdregprovW, method_createkeyW, 1, param_subkeynameW, CIM_STRING }, - { class_stdregprovW, method_createkeyW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, - { class_stdregprovW, method_enumkeyW, 1, param_defkeyW, CIM_SINT32, 0, 0x80000002 }, + { class_stdregprovW, method_createkeyW, -1, param_returnvalueW, CIM_UINT32 }, + { class_stdregprovW, method_enumkeyW, 1, param_defkeyW, CIM_SINT32, 0x80000002 }, { class_stdregprovW, method_enumkeyW, 1, param_subkeynameW, CIM_STRING }, - { class_stdregprovW, method_enumkeyW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, + { class_stdregprovW, method_enumkeyW, -1, param_returnvalueW, CIM_UINT32 }, { class_stdregprovW, method_enumkeyW, -1, param_namesW, CIM_STRING|CIM_FLAG_ARRAY }, - { class_stdregprovW, method_enumvaluesW, 1, param_defkeyW, CIM_SINT32, 0, 0x80000002 }, + { class_stdregprovW, method_enumvaluesW, 1, param_defkeyW, CIM_SINT32, 0x80000002 }, { class_stdregprovW, method_enumvaluesW, 1, param_subkeynameW, CIM_STRING }, - { class_stdregprovW, method_enumvaluesW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, + { class_stdregprovW, method_enumvaluesW, -1, param_returnvalueW, CIM_UINT32 }, { class_stdregprovW, method_enumvaluesW, -1, param_namesW, CIM_STRING|CIM_FLAG_ARRAY }, { class_stdregprovW, method_enumvaluesW, -1, param_typesW, CIM_SINT32|CIM_FLAG_ARRAY }, - { class_stdregprovW, method_getstringvalueW, 1, param_defkeyW, CIM_SINT32, 0, 0x80000002 }, + { class_stdregprovW, method_getstringvalueW, 1, param_defkeyW, CIM_SINT32, 0x80000002 }, { class_stdregprovW, method_getstringvalueW, 1, param_subkeynameW, CIM_STRING }, { class_stdregprovW, method_getstringvalueW, 1, param_valuenameW, CIM_STRING }, - { class_stdregprovW, method_getstringvalueW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, + { class_stdregprovW, method_getstringvalueW, -1, param_returnvalueW, CIM_UINT32 }, { class_stdregprovW, method_getstringvalueW, -1, param_valueW, CIM_STRING }, - { class_systemsecurityW, method_getsdW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, + { class_systemsecurityW, method_getsdW, -1, param_returnvalueW, CIM_UINT32 }, { class_systemsecurityW, method_getsdW, -1, param_sdW, CIM_UINT8|CIM_FLAG_ARRAY }, { class_systemsecurityW, method_setsdW, 1, param_sdW, CIM_UINT8|CIM_FLAG_ARRAY }, - { class_systemsecurityW, method_setsdW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, + { class_systemsecurityW, method_setsdW, -1, param_returnvalueW, CIM_UINT32 }, }; #define FLAVOR_ID (WBEM_FLAVOR_FLAG_PROPAGATE_TO_INSTANCE | WBEM_FLAVOR_NOT_OVERRIDABLE |\ @@ -1261,6 +1408,10 @@ static const struct record_qualifier data_qualifier[] = { class_process_getowner_outW, param_userW, CIM_SINT32, FLAVOR_ID, prop_idW, 0 }, { class_process_getowner_outW, param_domainW, CIM_SINT32, FLAVOR_ID, prop_idW, 1 } }; +static const struct record_quickfixengineering data_quickfixengineering[] = +{ + { quickfixengineering_captionW, quickfixengineering_hotfixidW }, +}; static const struct record_sounddevice data_sounddevice[] = { { sounddevice_productnameW, sounddevice_productnameW, 3 /* enabled */ } @@ -1275,25 +1426,18 @@ static UINT16 systemenclosure_chassistypes[] = }; static const struct array systemenclosure_chassistypes_array = { + sizeof(*systemenclosure_chassistypes), ARRAY_SIZE(systemenclosure_chassistypes), &systemenclosure_chassistypes }; -static const struct record_systemenclosure data_systemenclosure[] = -{ - { - systemenclosure_systemenclosureW, - &systemenclosure_chassistypes_array, - systemenclosure_systemenclosureW, - FALSE, - systemenclosure_manufacturerW, - systemenclosure_systemenclosureW, - systemenclosure_tagW, - } -}; static const struct record_systemsecurity data_systemsecurity[] = { { security_get_sd, security_set_sd } }; +static const struct record_winsat data_winsat[] = +{ + { 8.0f, 8.0f, 8.0f, 8.0f, 8.0f, winsat_timetakenW, 1 /* Valid */, 8.0f }, +}; /* check if row matches condition and update status */ static BOOL match_row( const struct table *table, UINT row, const struct expr *cond, enum fill_status *status ) @@ -1334,6 +1478,318 @@ static BOOL resize_table( struct table *table, UINT row_count, UINT row_size ) return TRUE; } +#include "pshpack1.h" +struct smbios_prologue +{ + BYTE calling_method; + BYTE major_version; + BYTE minor_version; + BYTE revision; + DWORD length; +}; + +enum smbios_type +{ + SMBIOS_TYPE_BIOS, + SMBIOS_TYPE_SYSTEM, + SMBIOS_TYPE_BASEBOARD, + SMBIOS_TYPE_CHASSIS, +}; + +struct smbios_header +{ + BYTE type; + BYTE length; + WORD handle; +}; + +struct smbios_baseboard +{ + struct smbios_header hdr; + BYTE vendor; + BYTE product; + BYTE version; + BYTE serial; +}; + +struct smbios_bios +{ + struct smbios_header hdr; + BYTE vendor; + BYTE version; + WORD start; + BYTE date; + BYTE size; + UINT64 characteristics; +}; + +struct smbios_chassis +{ + struct smbios_header hdr; + BYTE vendor; + BYTE type; + BYTE version; + BYTE serial; + BYTE asset_tag; +}; + +struct smbios_system +{ + struct smbios_header hdr; + BYTE vendor; + BYTE product; + BYTE version; + BYTE serial; + BYTE uuid[16]; +}; +#include "poppack.h" + +#define RSMB (('R' << 24) | ('S' << 16) | ('M' << 8) | 'B') + +static const struct smbios_header *find_smbios_entry( enum smbios_type type, const char *buf, UINT len ) +{ + const char *ptr, *start; + const struct smbios_prologue *prologue; + const struct smbios_header *hdr; + + if (len < sizeof(struct smbios_prologue)) return NULL; + prologue = (const struct smbios_prologue *)buf; + if (prologue->length > len - sizeof(*prologue) || prologue->length < sizeof(*hdr)) return NULL; + + start = (const char *)(prologue + 1); + hdr = (const struct smbios_header *)start; + + for (;;) + { + if ((const char *)hdr - start >= prologue->length - sizeof(*hdr)) return NULL; + + if (!hdr->length) + { + WARN( "invalid entry\n" ); + return NULL; + } + + if (hdr->type == type) + { + if ((const char *)hdr - start + hdr->length > prologue->length) return NULL; + break; + } + else /* skip other entries and their strings */ + { + for (ptr = (const char *)hdr + hdr->length; ptr - buf < len && *ptr; ptr++) + { + for (; ptr - buf < len; ptr++) if (!*ptr) break; + } + if (ptr == (const char *)hdr + hdr->length) ptr++; + hdr = (const struct smbios_header *)(ptr + 1); + } + } + + return hdr; +} + +static WCHAR *get_smbios_string( BYTE id, const char *buf, UINT offset, UINT buflen ) +{ + const char *ptr = buf + offset; + UINT i = 0; + + if (!id || offset >= buflen) return NULL; + for (ptr = buf + offset; ptr - buf < buflen && *ptr; ptr++) + { + if (++i == id) return heap_strdupAW( ptr ); + for (; ptr - buf < buflen; ptr++) if (!*ptr) break; + } + return NULL; +} + +static WCHAR *get_baseboard_string( BYTE id, const char *buf, UINT len ) +{ + const struct smbios_header *hdr; + const struct smbios_baseboard *baseboard; + UINT offset; + + if (!(hdr = find_smbios_entry( SMBIOS_TYPE_BASEBOARD, buf, len ))) return NULL; + + baseboard = (const struct smbios_baseboard *)hdr; + offset = (const char *)baseboard - buf + baseboard->hdr.length; + return get_smbios_string( id, buf, offset, len ); +} + +static WCHAR *get_baseboard_manufacturer( const char *buf, UINT len ) +{ + WCHAR *ret = get_baseboard_string( 1, buf, len ); + if (!ret) return heap_strdupW( baseboard_manufacturerW ); + return ret; +} + +static WCHAR *get_baseboard_product( const char *buf, UINT len ) +{ + WCHAR *ret = get_baseboard_string( 2, buf, len ); + if (!ret) return heap_strdupW( baseboard_tagW ); + return ret; +} + +static WCHAR *get_baseboard_serialnumber( const char *buf, UINT len ) +{ + WCHAR *ret = get_baseboard_string( 4, buf, len ); + if (!ret) return heap_strdupW( baseboard_serialnumberW ); + return ret; +} + +static WCHAR *get_baseboard_version( const char *buf, UINT len ) +{ + WCHAR *ret = get_baseboard_string( 3, buf, len ); + if (!ret) return heap_strdupW( baseboard_versionW ); + return ret; +} + +static enum fill_status fill_baseboard( struct table *table, const struct expr *cond ) +{ + struct record_baseboard *rec; + enum fill_status status = FILL_STATUS_UNFILTERED; + UINT row = 0, len; + char *buf; + + if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED; + + len = GetSystemFirmwareTable( RSMB, 0, NULL, 0 ); + if (!(buf = heap_alloc( len ))) return FILL_STATUS_FAILED; + GetSystemFirmwareTable( RSMB, 0, buf, len ); + + rec = (struct record_baseboard *)table->data; + rec->manufacturer = get_baseboard_manufacturer( buf, len ); + rec->model = baseboard_tagW; + rec->name = baseboard_tagW; + rec->product = get_baseboard_product( buf, len ); + rec->serialnumber = get_baseboard_serialnumber( buf, len ); + rec->tag = baseboard_tagW; + rec->version = get_baseboard_version( buf, len ); + if (!match_row( table, row, cond, &status )) free_row_values( table, row ); + else row++; + + heap_free( buf ); + + TRACE("created %u rows\n", row); + table->num_rows = row; + return status; +} + +static UINT16 get_bios_smbiosmajorversion( const char *buf, UINT len ) +{ + const struct smbios_prologue *prologue = (const struct smbios_prologue *)buf; + if (len < sizeof(*prologue)) return 2; + return prologue->major_version; +} + +static UINT16 get_bios_smbiosminorversion( const char *buf, UINT len ) +{ + const struct smbios_prologue *prologue = (const struct smbios_prologue *)buf; + if (len < sizeof(*prologue)) return 0; + return prologue->minor_version; +} + +static WCHAR *get_bios_string( BYTE id, const char *buf, UINT len ) +{ + const struct smbios_header *hdr; + const struct smbios_bios *bios; + UINT offset; + + if (!(hdr = find_smbios_entry( SMBIOS_TYPE_BIOS, buf, len ))) return NULL; + + bios = (const struct smbios_bios *)hdr; + offset = (const char *)bios - buf + bios->hdr.length; + return get_smbios_string( id, buf, offset, len ); +} + +static WCHAR *get_bios_manufacturer( const char *buf, UINT len ) +{ + WCHAR *ret = get_bios_string( 1, buf, len ); + if (!ret) return heap_strdupW( bios_manufacturerW ); + return ret; +} + +static WCHAR *convert_bios_date( const WCHAR *str ) +{ + static const WCHAR fmtW[] = + {'%','0','4','u','%','0','2','u','%','0','2','u','0','0','0','0','0','0','.','0','0','0','0','0','0','+','0','0','0',0}; + UINT year, month, day, len = lstrlenW( str ); + const WCHAR *p = str, *q; + WCHAR *ret; + + while (len && iswspace( *p )) { p++; len--; } + while (len && iswspace( p[len - 1] )) { len--; } + + q = p; + while (len && iswdigit( *q )) { q++; len--; }; + if (q - p != 2 || !len || *q != '/') return NULL; + month = (p[0] - '0') * 10 + p[1] - '0'; + + p = ++q; len--; + while (len && iswdigit( *q )) { q++; len--; }; + if (q - p != 2 || !len || *q != '/') return NULL; + day = (p[0] - '0') * 10 + p[1] - '0'; + + p = ++q; len--; + while (len && iswdigit( *q )) { q++; len--; }; + if (q - p == 4) year = (p[0] - '0') * 1000 + (p[1] - '0') * 100 + (p[2] - '0') * 10 + p[3] - '0'; + else if (q - p == 2) year = 1900 + (p[0] - '0') * 10 + p[1] - '0'; + else return NULL; + + if (!(ret = heap_alloc( sizeof(fmtW) ))) return NULL; + swprintf( ret, fmtW, year, month, day ); + return ret; +} + +static WCHAR *get_bios_releasedate( const char *buf, UINT len ) +{ + WCHAR *ret, *date = get_bios_string( 3, buf, len ); + if (!date || !(ret = convert_bios_date( date ))) ret = heap_strdupW( bios_releasedateW ); + heap_free( date ); + return ret; +} + +static WCHAR *get_bios_smbiosbiosversion( const char *buf, UINT len ) +{ + WCHAR *ret = get_bios_string( 2, buf, len ); + if (!ret) return heap_strdupW( bios_smbiosbiosversionW ); + return ret; +} + +static enum fill_status fill_bios( struct table *table, const struct expr *cond ) +{ + struct record_bios *rec; + enum fill_status status = FILL_STATUS_UNFILTERED; + UINT row = 0, len; + char *buf; + + if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED; + + len = GetSystemFirmwareTable( RSMB, 0, NULL, 0 ); + if (!(buf = heap_alloc( len ))) return FILL_STATUS_FAILED; + GetSystemFirmwareTable( RSMB, 0, buf, len ); + + rec = (struct record_bios *)table->data; + rec->currentlanguage = NULL; + rec->description = bios_descriptionW; + rec->identificationcode = NULL; + rec->manufacturer = get_bios_manufacturer( buf, len ); + rec->name = bios_descriptionW; + rec->releasedate = get_bios_releasedate( buf, len ); + rec->serialnumber = bios_serialnumberW; + rec->smbiosbiosversion = get_bios_smbiosbiosversion( buf, len ); + rec->smbiosmajorversion = get_bios_smbiosmajorversion( buf, len ); + rec->smbiosminorversion = get_bios_smbiosminorversion( buf, len ); + rec->version = bios_versionW; + if (!match_row( table, row, cond, &status )) free_row_values( table, row ); + else row++; + + heap_free( buf ); + + TRACE("created %u rows\n", row); + table->num_rows = row; + return status; +} + static enum fill_status fill_cdromdrive( struct table *table, const struct expr *cond ) { static const WCHAR fmtW[] = {'%','c',':',0}; @@ -1357,7 +1813,7 @@ static enum fill_status fill_cdromdrive( struct table *table, const struct expr rec = (struct record_cdromdrive *)(table->data + offset); rec->device_id = cdromdrive_pnpdeviceidW; - sprintfW( drive, fmtW, 'A' + i ); + swprintf( drive, fmtW, 'A' + i ); rec->drive = heap_strdupW( drive ); rec->mediatype = cdromdrive_mediatypeW; rec->name = cdromdrive_nameW; @@ -1384,6 +1840,7 @@ static UINT get_processor_count(void) return info.NumberOfProcessors; } +#ifdef __REACTOS__ static UINT get_logical_processor_count( UINT *num_cores ) { SYSTEM_LOGICAL_PROCESSOR_INFORMATION *info; @@ -1417,6 +1874,50 @@ static UINT get_logical_processor_count( UINT *num_cores ) heap_free( info ); return count; } +#else +static UINT get_logical_processor_count( UINT *num_physical, UINT *num_packages ) +{ + SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *buf, *entry; + UINT core_relation_count = 0, package_relation_count = 0; + NTSTATUS status; + ULONG len, offset = 0; + BOOL smt_enabled = FALSE; + DWORD all = RelationAll; + + if (num_packages) *num_packages = 1; + status = NtQuerySystemInformationEx( SystemLogicalProcessorInformationEx, &all, sizeof(all), NULL, 0, &len ); + if (status != STATUS_INFO_LENGTH_MISMATCH) return get_processor_count(); + + if (!(buf = heap_alloc( len ))) return get_processor_count(); + status = NtQuerySystemInformationEx( SystemLogicalProcessorInformationEx, &all, sizeof(all), buf, len, NULL ); + if (status != STATUS_SUCCESS) + { + heap_free( buf ); + return get_processor_count(); + } + + while (offset < len) + { + entry = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *)((char *)buf + offset); + + if (entry->Relationship == RelationProcessorCore) + { + core_relation_count++; + if (entry->u.Processor.Flags & LTP_PC_SMT) smt_enabled = TRUE; + } + else if (entry->Relationship == RelationProcessorPackage) + { + package_relation_count++; + } + offset += entry->Size; + } + + heap_free( buf ); + if (num_physical) *num_physical = core_relation_count; + if (num_packages) *num_packages = package_relation_count; + return smt_enabled ? core_relation_count * 2 : core_relation_count; +} +#endif static UINT64 get_total_physical_memory(void) { @@ -1479,8 +1980,12 @@ static enum fill_status fill_compsys( struct table *table, const struct expr *co rec->manufacturer = compsys_manufacturerW; rec->model = compsys_modelW; rec->name = get_computername(); +#ifdef __REACTOS__ rec->num_logical_processors = get_logical_processor_count( NULL ); rec->num_processors = get_processor_count(); +#else + rec->num_logical_processors = get_logical_processor_count( NULL, &rec->num_processors ); +#endif rec->total_physical_memory = get_total_physical_memory(); rec->username = get_username(); if (!match_row( table, row, cond, &status )) free_row_values( table, row ); @@ -1491,72 +1996,97 @@ static enum fill_status fill_compsys( struct table *table, const struct expr *co return status; } -static WCHAR *get_compsysproduct_uuid(void) +static WCHAR *get_compsysproduct_string( BYTE id, const char *buf, UINT len ) { -#ifdef __APPLE__ - unsigned char uuid[16]; - const struct timespec timeout = {1, 0}; - if (!gethostuuid( uuid, &timeout )) - { - static const WCHAR fmtW[] = - {'%','0','2','X','%','0','2','X','%','0','2','X','%','0','2','X','-','%','0','2','X','%','0','2','X','-', - '%','0','2','X','%','0','2','X','-','%','0','2','X','%','0','2','X','-','%','0','2','X','%','0','2','X', - '%','0','2','X','%','0','2','X','%','0','2','X','%','0','2','X',0}; - WCHAR *ret = heap_alloc( 37 * sizeof(WCHAR) ); - if (!ret) return NULL; - sprintfW( ret, fmtW, uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5], uuid[6], uuid[7], - uuid[8], uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15] ); - return ret; - } -#endif -#ifdef __linux__ - int file; - if ((file = open( "/var/lib/dbus/machine-id", O_RDONLY )) != -1) - { - unsigned char buf[32]; - if (read( file, buf, sizeof(buf) ) == sizeof(buf)) - { - unsigned int i, j; - WCHAR *ret, *p; - - close( file ); - if (!(p = ret = heap_alloc( 37 * sizeof(WCHAR) ))) return NULL; - for (i = 0, j = 0; i < 8; i++) p[i] = toupperW( buf[j++] ); - p[8] = '-'; - for (i = 9; i < 13; i++) p[i] = toupperW( buf[j++] ); - p[13] = '-'; - for (i = 14; i < 18; i++) p[i] = toupperW( buf[j++] ); - p[18] = '-'; - for (i = 19; i < 23; i++) p[i] = toupperW( buf[j++] ); - p[23] = '-'; - for (i = 24; i < 36; i++) p[i] = toupperW( buf[j++] ); - ret[i] = 0; - return ret; - } - close( file ); - } -#endif - return heap_strdupW( compsysproduct_uuidW ); + const struct smbios_header *hdr; + const struct smbios_system *system; + UINT offset; + + if (!(hdr = find_smbios_entry( SMBIOS_TYPE_SYSTEM, buf, len ))) return NULL; + + system = (const struct smbios_system *)hdr; + offset = (const char *)system - buf + system->hdr.length; + return get_smbios_string( id, buf, offset, len ); +} + +static WCHAR *get_compsysproduct_identifyingnumber( const char *buf, UINT len ) +{ + WCHAR *ret = get_compsysproduct_string( 4, buf, len ); + if (!ret) return heap_strdupW( compsysproduct_identifyingnumberW ); + return ret; +} + +static WCHAR *get_compsysproduct_name( const char *buf, UINT len ) +{ + WCHAR *ret = get_compsysproduct_string( 2, buf, len ); + if (!ret) return heap_strdupW( compsysproduct_nameW ); + return ret; +} + +static WCHAR *get_compsysproduct_uuid( const char *buf, UINT len ) +{ + static const WCHAR fmtW[] = + {'%','0','2','X','%','0','2','X','%','0','2','X','%','0','2','X','-','%','0','2','X','%','0','2','X','-', + '%','0','2','X','%','0','2','X','-','%','0','2','X','%','0','2','X','-','%','0','2','X','%','0','2','X', + '%','0','2','X','%','0','2','X','%','0','2','X','%','0','2','X',0}; + static const BYTE none[] = {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; + const struct smbios_header *hdr; + const struct smbios_system *system; + const BYTE *ptr; + WCHAR *ret = NULL; + + if (!(hdr = find_smbios_entry( SMBIOS_TYPE_SYSTEM, buf, len )) || hdr->length < sizeof(*system)) goto done; + system = (const struct smbios_system *)hdr; + if (!memcmp( system->uuid, none, sizeof(none) ) || !(ret = heap_alloc( 37 * sizeof(WCHAR) ))) goto done; + + ptr = system->uuid; + swprintf( ret, fmtW, ptr[0], ptr[1], ptr[2], ptr[3], ptr[4], ptr[5], ptr[6], ptr[7], ptr[8], ptr[9], + ptr[10], ptr[11], ptr[12], ptr[13], ptr[14], ptr[15] ); + +done: + if (!ret) ret = heap_strdupW( compsysproduct_uuidW ); + return ret; +} + +static WCHAR *get_compsysproduct_vendor( const char *buf, UINT len ) +{ + WCHAR *ret = get_compsysproduct_string( 1, buf, len ); + if (!ret) return heap_strdupW( compsysproduct_vendorW ); + return ret; +} + +static WCHAR *get_compsysproduct_version( const char *buf, UINT len ) +{ + WCHAR *ret = get_compsysproduct_string( 3, buf, len ); + if (!ret) return heap_strdupW( compsysproduct_versionW ); + return ret; } static enum fill_status fill_compsysproduct( struct table *table, const struct expr *cond ) { struct record_computersystemproduct *rec; enum fill_status status = FILL_STATUS_UNFILTERED; - UINT row = 0; + UINT row = 0, len; + char *buf; if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED; + len = GetSystemFirmwareTable( RSMB, 0, NULL, 0 ); + if (!(buf = heap_alloc( len ))) return FILL_STATUS_FAILED; + GetSystemFirmwareTable( RSMB, 0, buf, len ); + rec = (struct record_computersystemproduct *)table->data; - rec->identifyingnumber = compsysproduct_identifyingnumberW; - rec->name = compsysproduct_nameW; + rec->identifyingnumber = get_compsysproduct_identifyingnumber( buf, len ); + rec->name = get_compsysproduct_name( buf, len ); rec->skunumber = NULL; - rec->uuid = get_compsysproduct_uuid(); - rec->vendor = compsysproduct_vendorW; - rec->version = compsysproduct_versionW; + rec->uuid = get_compsysproduct_uuid( buf, len ); + rec->vendor = get_compsysproduct_vendor( buf, len ); + rec->version = get_compsysproduct_version( buf, len ); if (!match_row( table, row, cond, &status )) free_row_values( table, row ); else row++; + heap_free( buf ); + TRACE("created %u rows\n", row); table->num_rows = row; return status; @@ -1703,9 +2233,9 @@ static WCHAR *build_dirname( const WCHAR *path, UINT *ret_len ) UINT len, i; WCHAR *ret; - if (!isalphaW( p[0] ) || p[1] != ':' || p[2] != '\\' || p[3] != '\\' || !p[4]) return NULL; + if (!iswalpha( p[0] ) || p[1] != ':' || p[2] != '\\' || p[3] != '\\' || !p[4]) return NULL; start = path + 4; - len = strlenW( start ); + len = lstrlenW( start ); p = start + len - 1; if (*p == '\\') return NULL; @@ -1730,7 +2260,7 @@ static WCHAR *build_dirname( const WCHAR *path, UINT *ret_len ) static BOOL seen_dir( struct dirstack *dirstack, const WCHAR *path ) { UINT i; - for (i = 0; i < dirstack->num_dirs; i++) if (!strcmpW( dirstack->dirs[i], path )) return TRUE; + for (i = 0; i < dirstack->num_dirs; i++) if (!wcscmp( dirstack->dirs[i], path )) return TRUE; return FALSE; } @@ -1750,14 +2280,14 @@ static UINT seed_dirs( struct dirstack *dirstack, const struct expr *cond, WCHAR const WCHAR *str = NULL; if (left->type == EXPR_PROPVAL && right->type == EXPR_SVAL && - !strcmpW( left->u.propval->name, prop_nameW ) && - toupperW( right->u.sval[0] ) == toupperW( root )) + !wcscmp( left->u.propval->name, prop_nameW ) && + towupper( right->u.sval[0] ) == towupper( root )) { str = right->u.sval; } else if (left->type == EXPR_SVAL && right->type == EXPR_PROPVAL && - !strcmpW( right->u.propval->name, prop_nameW ) && - toupperW( left->u.sval[0] ) == toupperW( root )) + !wcscmp( right->u.propval->name, prop_nameW ) && + towupper( left->u.sval[0] ) == towupper( root )) { str = left->u.sval; } @@ -1786,11 +2316,11 @@ static UINT seed_dirs( struct dirstack *dirstack, const struct expr *cond, WCHAR static WCHAR *append_path( const WCHAR *path, const WCHAR *segment, UINT *len ) { - UINT len_path = 0, len_segment = strlenW( segment ); + UINT len_path = 0, len_segment = lstrlenW( segment ); WCHAR *ret; *len = 0; - if (path) len_path = strlenW( path ); + if (path) len_path = lstrlenW( path ); if (!(ret = heap_alloc( (len_path + len_segment + 2) * sizeof(WCHAR) ))) return NULL; if (path && len_path) { @@ -1808,11 +2338,11 @@ static WCHAR *get_file_version( const WCHAR *filename ) { static const WCHAR slashW[] = {'\\',0}, fmtW[] = {'%','u','.','%','u','.','%','u','.','%','u',0}; VS_FIXEDFILEINFO *info; - DWORD size; + DWORD size, len = 4 * 5 + ARRAY_SIZE( fmtW ); void *block; WCHAR *ret; - if (!(ret = heap_alloc( (4 * 5 + ARRAY_SIZE( fmtW )) * sizeof(WCHAR) ))) return NULL; + if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL; if (!(size = GetFileVersionInfoSizeW( filename, NULL )) || !(block = heap_alloc( size ))) { heap_free( ret ); @@ -1825,8 +2355,8 @@ static WCHAR *get_file_version( const WCHAR *filename ) heap_free( ret ); return NULL; } - sprintfW( ret, fmtW, info->dwFileVersionMS >> 16, info->dwFileVersionMS & 0xffff, - info->dwFileVersionLS >> 16, info->dwFileVersionLS & 0xffff ); + swprintf( ret, fmtW, info->dwFileVersionMS >> 16, info->dwFileVersionMS & 0xffff, + info->dwFileVersionLS >> 16, info->dwFileVersionLS & 0xffff ); heap_free( block ); return ret; } @@ -1877,7 +2407,7 @@ static enum fill_status fill_datafile( struct table *table, const struct expr *c FindClose( handle ); goto done; } - if (!strcmpW( data.cFileName, dotW ) || !strcmpW( data.cFileName, dotdotW )) continue; + if (!wcscmp( data.cFileName, dotW ) || !wcscmp( data.cFileName, dotdotW )) continue; new_path = append_path( path, data.cFileName, &len ); if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) @@ -1999,7 +2529,7 @@ static enum fill_status fill_directory( struct table *table, const struct expr * goto done; } if (!(data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || - !strcmpW( data.cFileName, dotW ) || !strcmpW( data.cFileName, dotdotW )) + !wcscmp( data.cFileName, dotW ) || !wcscmp( data.cFileName, dotdotW )) continue; new_path = append_path( path, data.cFileName, &len ); @@ -2092,15 +2622,12 @@ static enum fill_status fill_diskdrive( struct table *table, const struct expr * if (!resize_table( table, row + 1, sizeof(*rec) )) return FILL_STATUS_FAILED; rec = (struct record_diskdrive *)(table->data + offset); - sprintfW( device_id, fmtW, index ); + swprintf( device_id, fmtW, index ); rec->device_id = heap_strdupW( device_id ); - rec->index = index; + rec->index = index++; rec->interfacetype = diskdrive_interfacetypeW; rec->manufacturer = diskdrive_manufacturerW; - if (type == DRIVE_FIXED) - rec->mediatype = diskdrive_mediatype_fixedW; - else - rec->mediatype = diskdrive_mediatype_removableW; + rec->mediatype = (type == DRIVE_FIXED) ? diskdrive_mediatype_fixedW : diskdrive_mediatype_removableW; rec->model = diskdrive_modelW; rec->pnpdevice_id = diskdrive_pnpdeviceidW; rec->serialnumber = diskdrive_serialW; @@ -2112,7 +2639,6 @@ static enum fill_status fill_diskdrive( struct table *table, const struct expr * continue; } offset += sizeof(*rec); - index++; row++; } } @@ -2121,6 +2647,110 @@ static enum fill_status fill_diskdrive( struct table *table, const struct expr * return status; } +struct association +{ + WCHAR *ref; + WCHAR *ref2; +}; + +static void free_assocations( struct association *assoc, UINT count ) +{ + UINT i; + if (!assoc) return; + for (i = 0; i < count; i++) + { + heap_free( assoc[i].ref ); + heap_free( assoc[i].ref2 ); + } + heap_free( assoc ); +} + +static struct association *get_diskdrivetodiskpartition_pairs( UINT *count ) +{ + static const WCHAR pathW[] = + {'_','_','P','A','T','H',0}; + static const WCHAR selectW[] = + {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', + 'D','i','s','k','D','r','i','v','e',0}; + static const WCHAR select2W[] = + {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', + 'D','i','s','k','P','a','r','t','i','t','i','o','n',0}; + struct association *ret = NULL; + struct query *query, *query2 = NULL; + VARIANT val; + HRESULT hr; + UINT i; + + if (!(query = create_query())) return NULL; + if ((hr = parse_query( selectW, &query->view, &query->mem )) != S_OK) goto done; + if ((hr = execute_view( query->view )) != S_OK) goto done; + + if (!(query2 = create_query())) return FALSE; + if ((hr = parse_query( select2W, &query2->view, &query2->mem )) != S_OK) goto done; + if ((hr = execute_view( query2->view )) != S_OK) goto done; + + if (!(ret = heap_alloc_zero( query->view->result_count * sizeof(*ret) ))) goto done; + + for (i = 0; i < query->view->result_count; i++) + { + if ((hr = get_propval( query->view, i, pathW, &val, NULL, NULL )) != S_OK) goto done; + if (!(ret[i].ref = heap_strdupW( V_BSTR(&val) ))) goto done; + VariantClear( &val ); + + if ((hr = get_propval( query2->view, i, pathW, &val, NULL, NULL )) != S_OK) goto done; + if (!(ret[i].ref2 = heap_strdupW( V_BSTR(&val) ))) goto done; + VariantClear( &val ); + } + + *count = query->view->result_count; + +done: + if (!ret) free_assocations( ret, query->view->result_count ); + free_query( query ); + free_query( query2 ); + return ret; +} + +static enum fill_status fill_diskdrivetodiskpartition( struct table *table, const struct expr *cond ) +{ + struct record_diskdrivetodiskpartition *rec; + UINT i, row = 0, offset = 0, count = 0; + enum fill_status status = FILL_STATUS_UNFILTERED; + struct association *assoc; + + if (!(assoc = get_diskdrivetodiskpartition_pairs( &count ))) return FILL_STATUS_FAILED; + if (!count) + { + free_assocations( assoc, count ); + return FILL_STATUS_UNFILTERED; + } + if (!resize_table( table, count, sizeof(*rec) )) + { + free_assocations( assoc, count ); + return FILL_STATUS_FAILED; + } + + for (i = 0; i < count; i++) + { + rec = (struct record_diskdrivetodiskpartition *)(table->data + offset); + rec->antecedent = assoc[i].ref; + rec->dependent = assoc[i].ref2; + if (!match_row( table, row, cond, &status )) + { + free_row_values( table, row ); + continue; + } + offset += sizeof(*rec); + row++; + } + + heap_free( assoc ); + + TRACE("created %u rows\n", row); + table->num_rows = row; + return status; +} + static WCHAR *get_filesystem( const WCHAR *root ) { static const WCHAR ntfsW[] = {'N','T','F','S',0}; @@ -2158,9 +2788,9 @@ static enum fill_status fill_diskpartition( struct table *table, const struct ex rec = (struct record_diskpartition *)(table->data + offset); rec->bootable = (i == 2) ? -1 : 0; rec->bootpartition = (i == 2) ? -1 : 0; - sprintfW( device_id, fmtW, index ); + swprintf( device_id, fmtW, index ); rec->device_id = heap_strdupW( device_id ); - rec->diskindex = index; + rec->diskindex = index++; rec->index = 0; rec->pnpdevice_id = heap_strdupW( device_id ); get_freespace( root, &size ); @@ -2174,7 +2804,6 @@ static enum fill_status fill_diskpartition( struct table *table, const struct ex } offset += sizeof(*rec); row++; - index++; } } TRACE("created %u rows\n", row); @@ -2182,13 +2811,49 @@ static enum fill_status fill_diskpartition( struct table *table, const struct ex return status; } +static UINT32 get_bitsperpixel( UINT *hres, UINT *vres ) +{ + HDC hdc = GetDC( NULL ); + UINT32 ret; + + if (!hdc) return 32; + ret = GetDeviceCaps( hdc, BITSPIXEL ); + *hres = GetDeviceCaps( hdc, HORZRES ); + *vres = GetDeviceCaps( hdc, VERTRES ); + ReleaseDC( NULL, hdc ); + return ret; +} + +static enum fill_status fill_displaycontrollerconfig( struct table *table, const struct expr *cond ) +{ + struct record_displaycontrollerconfig *rec; + UINT row = 0, hres = 1024, vres = 768; + enum fill_status status = FILL_STATUS_UNFILTERED; + + if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED; + + rec = (struct record_displaycontrollerconfig *)table->data; + rec->bitsperpixel = get_bitsperpixel( &hres, &vres ); + rec->caption = videocontroller_deviceidW; + rec->horizontalresolution = hres; + rec->name = videocontroller_deviceidW; + rec->verticalresolution = vres; + if (!match_row( table, row, cond, &status )) free_row_values( table, row ); + else row++; + + TRACE("created %u rows\n", row); + table->num_rows = row; + return status; +} + static WCHAR *get_ip4_string( DWORD addr ) { static const WCHAR fmtW[] = {'%','u','.','%','u','.','%','u','.','%','u',0}; + DWORD len = sizeof("ddd.ddd.ddd.ddd"); WCHAR *ret; - if (!(ret = heap_alloc( sizeof("ddd.ddd.ddd.ddd") * sizeof(WCHAR) ))) return NULL; - sprintfW( ret, fmtW, (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff ); + if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL; + swprintf( ret, fmtW, (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff ); return ret; } @@ -2248,7 +2913,7 @@ static WCHAR *get_volumeserialnumber( const WCHAR *root ) WCHAR buffer[9]; GetVolumeInformationW( root, NULL, 0, &serial, NULL, NULL, NULL, 0 ); - sprintfW( buffer, fmtW, serial ); + swprintf( buffer, fmtW, serial ); return heap_strdupW( buffer ); } @@ -2276,7 +2941,7 @@ static enum fill_status fill_logicaldisk( struct table *table, const struct expr if (!resize_table( table, row + 1, sizeof(*rec) )) return FILL_STATUS_FAILED; rec = (struct record_logicaldisk *)(table->data + offset); - sprintfW( device_id, fmtW, 'A' + i ); + swprintf( device_id, fmtW, 'A' + i ); rec->device_id = heap_strdupW( device_id ); rec->drivetype = type; rec->filesystem = get_filesystem( root ); @@ -2299,6 +2964,94 @@ static enum fill_status fill_logicaldisk( struct table *table, const struct expr return status; } +static struct association *get_logicaldisktopartition_pairs( UINT *count ) +{ + static const WCHAR pathW[] = + {'_','_','P','A','T','H',0}; + static const WCHAR selectW[] = + {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', + 'D','i','s','k','P','a','r','t','i','t','i','o','n',0}; + static const WCHAR select2W[] = + {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', + 'L','o','g','i','c','a','l','D','i','s','k',' ','W','H','E','R','E',' ', + 'D','r','i','v','e','T','y','p','e','=','2',' ','O','R',' ','D','r','i','v','e','T','y','p','e','=','3',0}; + struct association *ret = NULL; + struct query *query, *query2 = NULL; + VARIANT val; + HRESULT hr; + UINT i; + + if (!(query = create_query())) return NULL; + if ((hr = parse_query( selectW, &query->view, &query->mem )) != S_OK) goto done; + if ((hr = execute_view( query->view )) != S_OK) goto done; + + if (!(query2 = create_query())) return FALSE; + if ((hr = parse_query( select2W, &query2->view, &query2->mem )) != S_OK) goto done; + if ((hr = execute_view( query2->view )) != S_OK) goto done; + + if (!(ret = heap_alloc_zero( query->view->result_count * sizeof(*ret) ))) goto done; + + /* assume fixed and removable disks are enumerated in the same order as partitions */ + for (i = 0; i < query->view->result_count; i++) + { + if ((hr = get_propval( query->view, i, pathW, &val, NULL, NULL )) != S_OK) goto done; + if (!(ret[i].ref = heap_strdupW( V_BSTR(&val) ))) goto done; + VariantClear( &val ); + + if ((hr = get_propval( query2->view, i, pathW, &val, NULL, NULL )) != S_OK) goto done; + if (!(ret[i].ref2 = heap_strdupW( V_BSTR(&val) ))) goto done; + VariantClear( &val ); + } + + *count = query->view->result_count; + +done: + if (!ret) free_assocations( ret, query->view->result_count ); + free_query( query ); + free_query( query2 ); + return ret; +} + +static enum fill_status fill_logicaldisktopartition( struct table *table, const struct expr *cond ) +{ + struct record_logicaldisktopartition *rec; + UINT i, row = 0, offset = 0, count = 0; + enum fill_status status = FILL_STATUS_UNFILTERED; + struct association *assoc; + + if (!(assoc = get_logicaldisktopartition_pairs( &count ))) return FILL_STATUS_FAILED; + if (!count) + { + free_assocations( assoc, count ); + return FILL_STATUS_UNFILTERED; + } + if (!resize_table( table, count, sizeof(*rec) )) + { + free_assocations( assoc, count ); + return FILL_STATUS_FAILED; + } + + for (i = 0; i < count; i++) + { + rec = (struct record_logicaldisktopartition *)(table->data + offset); + rec->antecedent = assoc[i].ref; + rec->dependent = assoc[i].ref2; + if (!match_row( table, row, cond, &status )) + { + free_row_values( table, row ); + continue; + } + offset += sizeof(*rec); + row++; + } + + heap_free( assoc ); + + TRACE("created %u rows\n", row); + table->num_rows = row; + return status; +} + static UINT16 get_connection_status( IF_OPER_STATUS status ) { switch (status) @@ -2321,10 +3074,10 @@ static WCHAR *get_mac_address( const BYTE *addr, DWORD len ) WCHAR *ret; if (len != 6 || !(ret = heap_alloc( 18 * sizeof(WCHAR) ))) return NULL; - sprintfW( ret, fmtW, addr[0], addr[1], addr[2], addr[3], addr[4], addr[5] ); + swprintf( ret, fmtW, addr[0], addr[1], addr[2], addr[3], addr[4], addr[5] ); return ret; } -static const WCHAR *get_adaptertype( DWORD type, int *physical ) +static const WCHAR *get_adaptertype( DWORD type, int *id, int *physical ) { static const WCHAR ethernetW[] = {'E','t','h','e','r','n','e','t',' ','8','0','2','.','3',0}; static const WCHAR wirelessW[] = {'W','i','r','e','l','e','s','s',0}; @@ -2333,11 +3086,26 @@ static const WCHAR *get_adaptertype( DWORD type, int *physical ) switch (type) { - case IF_TYPE_ETHERNET_CSMACD: *physical = -1; return ethernetW; - case IF_TYPE_IEEE80211: *physical = -1; return wirelessW; - case IF_TYPE_IEEE1394: *physical = -1; return firewireW; - case IF_TYPE_TUNNEL: *physical = 0; return tunnelW; - default: *physical = 0; return NULL; + case IF_TYPE_ETHERNET_CSMACD: + *id = 0; + *physical = -1; + return ethernetW; + case IF_TYPE_IEEE80211: + *id = 9; + *physical = -1; + return wirelessW; + case IF_TYPE_IEEE1394: + *id = 13; + *physical = -1; + return firewireW; + case IF_TYPE_TUNNEL: + *id = 15; + *physical = 0; + return tunnelW; + default: + *id = -1; + *physical = 0; + return NULL; } } @@ -2349,7 +3117,7 @@ static enum fill_status fill_networkadapter( struct table *table, const struct e IP_ADAPTER_ADDRESSES *aa, *buffer; UINT row = 0, offset = 0, count = 0; DWORD size = 0, ret; - int physical; + int adaptertypeid, physical; enum fill_status status = FILL_STATUS_UNFILTERED; ret = GetAdaptersAddresses( AF_UNSPEC, 0, NULL, NULL, &size ); @@ -2375,8 +3143,10 @@ static enum fill_status fill_networkadapter( struct table *table, const struct e if (aa->IfType == IF_TYPE_SOFTWARE_LOOPBACK) continue; rec = (struct record_networkadapter *)(table->data + offset); - sprintfW( device_id, fmtW, aa->u.s.IfIndex ); - rec->adaptertype = get_adaptertype( aa->IfType, &physical ); + swprintf( device_id, fmtW, aa->u.s.IfIndex ); + rec->adaptertype = get_adaptertype( aa->IfType, &adaptertypeid, &physical ); + rec->adaptertypeid = adaptertypeid; + rec->description = heap_strdupW( aa->Description ); rec->device_id = heap_strdupW( device_id ); rec->index = aa->u.s.IfIndex; rec->interface_index = aa->u.s.IfIndex; @@ -2440,8 +3210,9 @@ static struct array *get_defaultipgateway( IP_ADAPTER_GATEWAY_ADDRESS *list ) return NULL; } } - ret->count = count; - ret->ptr = ptr; + ret->elem_size = sizeof(*ptr); + ret->count = count; + ret->ptr = ptr; return ret; } static struct array *get_dnsserversearchorder( IP_ADAPTER_DNS_SERVER_ADDRESS *list ) @@ -2471,10 +3242,11 @@ static struct array *get_dnsserversearchorder( IP_ADAPTER_DNS_SERVER_ADDRESS *li heap_free( ret ); return NULL; } - if ((p = strrchrW( ptr[i - 1], ':' ))) *p = 0; + if ((p = wcsrchr( ptr[i - 1], ':' ))) *p = 0; } - ret->count = count; - ret->ptr = ptr; + ret->elem_size = sizeof(*ptr); + ret->count = count; + ret->ptr = ptr; return ret; } @@ -2508,8 +3280,9 @@ static struct array *get_ipaddress( IP_ADAPTER_UNICAST_ADDRESS_LH *list ) return NULL; } } - ret->count = count; - ret->ptr = ptr; + ret->elem_size = sizeof(*ptr); + ret->count = count; + ret->ptr = ptr; return ret; } static struct array *get_ipsubnet( IP_ADAPTER_UNICAST_ADDRESS_LH *list ) @@ -2530,14 +3303,14 @@ static struct array *get_ipsubnet( IP_ADAPTER_UNICAST_ADDRESS_LH *list ) } for (address = list; address; address = address->Next) { - if (address->Address.lpSockaddr->sa_family == WS_AF_INET) + if (address->Address.lpSockaddr->sa_family == AF_INET) { WCHAR buf[INET_ADDRSTRLEN]; SOCKADDR_IN addr; ULONG buflen = ARRAY_SIZE( buf ); memset( &addr, 0, sizeof(addr) ); - addr.sin_family = WS_AF_INET; + addr.sin_family = AF_INET; if (ConvertLengthToIpv4Mask( address->OnLinkPrefixLength, &addr.sin_addr.S_un.S_addr ) != NO_ERROR || WSAAddressToStringW( (SOCKADDR*)&addr, sizeof(addr), NULL, buf, &buflen)) ptr[i] = NULL; @@ -2549,7 +3322,7 @@ static struct array *get_ipsubnet( IP_ADAPTER_UNICAST_ADDRESS_LH *list ) static const WCHAR fmtW[] = {'%','u',0}; WCHAR buf[11]; - sprintfW(buf, fmtW, address->OnLinkPrefixLength); + swprintf( buf, fmtW, address->OnLinkPrefixLength ); ptr[i] = heap_strdupW( buf ); } if (!ptr[i++]) @@ -2560,8 +3333,9 @@ static struct array *get_ipsubnet( IP_ADAPTER_UNICAST_ADDRESS_LH *list ) return NULL; } } - ret->count = count; - ret->ptr = ptr; + ret->elem_size = sizeof(*ptr); + ret->count = count; + ret->ptr = ptr; return ret; } @@ -2643,6 +3417,7 @@ static enum fill_status fill_networkadapterconfig( struct table *table, const st static enum fill_status fill_physicalmemory( struct table *table, const struct expr *cond ) { + static const WCHAR dimm0W[] = {'D','I','M','M',' ','0',0}; struct record_physicalmemory *rec; enum fill_status status = FILL_STATUS_UNFILTERED; UINT row = 0; @@ -2650,8 +3425,11 @@ static enum fill_status fill_physicalmemory( struct table *table, const struct e if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED; rec = (struct record_physicalmemory *)table->data; - rec->capacity = get_total_physical_memory(); - rec->memorytype = 9; /* RAM */ + rec->capacity = get_total_physical_memory(); + rec->configuredclockspeed = 0; + rec->devicelocator = dimm0W; + rec->memorytype = 9; /* RAM */ + rec->partnumber = NULL; if (!match_row( table, row, cond, &status )) free_row_values( table, row ); else row++; @@ -2717,7 +3495,7 @@ static enum fill_status fill_printer( struct table *table, const struct expr *co WCHAR id[20]; EnumPrintersW( PRINTER_ENUM_LOCAL, NULL, 2, NULL, 0, &size, &count ); - if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) return FILL_STATUS_FAILED; + if (!count) return FILL_STATUS_UNFILTERED; if (!(info = heap_alloc( size ))) return FILL_STATUS_FAILED; if (!EnumPrintersW( PRINTER_ENUM_LOCAL, NULL, 2, (BYTE *)info, size, &size, &count )) @@ -2735,7 +3513,7 @@ static enum fill_status fill_printer( struct table *table, const struct expr *co { rec = (struct record_printer *)(table->data + offset); rec->attributes = info[i].Attributes; - sprintfW( id, fmtW, i ); + swprintf( id, fmtW, i ); rec->device_id = heap_strdupW( id ); rec->drivername = heap_strdupW( info[i].pDriverName ); rec->horizontalresolution = info[i].pDevMode->u1.s1.dmPrintQuality; @@ -2784,13 +3562,17 @@ static enum fill_status fill_process( struct table *table, const struct expr *co do { - if (!resize_table( table, row + 1, sizeof(*rec) )) goto done; + if (!resize_table( table, row + 1, sizeof(*rec) )) + { + status = FILL_STATUS_FAILED; + goto done; + } rec = (struct record_process *)(table->data + offset); rec->caption = heap_strdupW( entry.szExeFile ); rec->commandline = get_cmdline( entry.th32ProcessID ); rec->description = heap_strdupW( entry.szExeFile ); - sprintfW( handle, fmtW, entry.th32ProcessID ); + swprintf( handle, fmtW, entry.th32ProcessID ); rec->handle = heap_strdupW( handle ); rec->name = heap_strdupW( entry.szExeFile ); rec->process_id = entry.th32ProcessID; @@ -2809,27 +3591,85 @@ static enum fill_status fill_process( struct table *table, const struct expr *co TRACE("created %u rows\n", row); table->num_rows = row; - status = FILL_STATUS_UNFILTERED; done: CloseHandle( snap ); return status; } -static inline void do_cpuid( unsigned int ax, unsigned int *p ) +extern void do_cpuid( unsigned int ax, unsigned int *p ); +#if defined(_MSC_VER) +void do_cpuid( unsigned int ax, unsigned int *p ) { -#ifdef __i386__ -#ifdef _MSC_VER - __cpuid(p, ax); + __cpuid( p, ax ); +} +#elif defined(__i386__) +__ASM_GLOBAL_FUNC( do_cpuid, + "pushl %esi\n\t" + "pushl %ebx\n\t" + "movl 12(%esp),%eax\n\t" + "movl 16(%esp),%esi\n\t" + "cpuid\n\t" + "movl %eax,(%esi)\n\t" + "movl %ebx,4(%esi)\n\t" + "movl %ecx,8(%esi)\n\t" + "movl %edx,12(%esi)\n\t" + "popl %ebx\n\t" + "popl %esi\n\t" + "ret" ) +#elif defined(__x86_64__) +__ASM_GLOBAL_FUNC( do_cpuid, + "pushq %rsi\n\t" + "pushq %rbx\n\t" + "movq %rcx,%rax\n\t" + "movq %rdx,%rsi\n\t" + "cpuid\n\t" + "movl %eax,(%rsi)\n\t" + "movl %ebx,4(%rsi)\n\t" + "movl %ecx,8(%rsi)\n\t" + "movl %edx,12(%rsi)\n\t" + "popq %rbx\n\t" + "popq %rsi\n\t" + "ret" ) #else - __asm__("pushl %%ebx\n\t" - "cpuid\n\t" - "movl %%ebx, %%esi\n\t" - "popl %%ebx" - : "=a" (p[0]), "=S" (p[1]), "=c" (p[2]), "=d" (p[3]) - : "0" (ax)); -#endif +void do_cpuid( unsigned int ax, unsigned int *p ) +{ + FIXME("\n"); +} #endif + +static unsigned int get_processor_model( unsigned int reg0, unsigned int *stepping, unsigned int *family ) +{ + unsigned int model, family_id = (reg0 & (0x0f << 8)) >> 8; + + model = (reg0 & (0x0f << 4)) >> 4; + if (family_id == 6 || family_id == 15) model |= (reg0 & (0x0f << 16)) >> 12; + if (family) + { + *family = family_id; + if (family_id == 15) *family += (reg0 & (0xff << 20)) >> 20; + } + *stepping = reg0 & 0x0f; + return model; +} +static void regs_to_str( unsigned int *regs, unsigned int len, WCHAR *buffer ) +{ + unsigned int i; + unsigned char *p = (unsigned char *)regs; + + for (i = 0; i < len; i++) { buffer[i] = *p++; } + buffer[i] = 0; +} +static void get_processor_manufacturer( WCHAR *manufacturer, UINT len ) +{ + unsigned int tmp, regs[4] = {0, 0, 0, 0}; + + do_cpuid( 0, regs ); + tmp = regs[2]; /* swap edx and ecx */ + regs[2] = regs[3]; + regs[3] = tmp; + + regs_to_str( regs + 1, min( 12, len ), manufacturer ); } static const WCHAR *get_osarchitecture(void) { @@ -2838,27 +3678,39 @@ static const WCHAR *get_osarchitecture(void) if (info.u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) return os_64bitW; return os_32bitW; } -static void get_processor_caption( WCHAR *caption ) +static void get_processor_caption( WCHAR *caption, UINT len ) { static const WCHAR fmtW[] = {'%','s',' ','F','a','m','i','l','y',' ','%','u',' ', 'M','o','d','e','l',' ','%','u',' ','S','t','e','p','p','i','n','g',' ','%','u',0}; static const WCHAR x86W[] = {'x','8','6',0}; static const WCHAR intel64W[] = {'I','n','t','e','l','6','4',0}; - const WCHAR *arch = (get_osarchitecture() == os_32bitW) ? x86W : intel64W; - unsigned int regs[4] = {0, 0, 0, 0}; + static const WCHAR amd64W[] = {'A','M','D','6','4',0}; + static const WCHAR authenticamdW[] = {'A','u','t','h','e','n','t','i','c','A','M','D',0}; + const WCHAR *arch; + WCHAR manufacturer[13]; + unsigned int regs[4] = {0, 0, 0, 0}, family, model, stepping; + + get_processor_manufacturer( manufacturer, ARRAY_SIZE( manufacturer ) ); + if (get_osarchitecture() == os_32bitW) arch = x86W; + else if (!wcscmp( manufacturer, authenticamdW )) arch = amd64W; + else arch = intel64W; do_cpuid( 1, regs ); - sprintfW( caption, fmtW, arch, (regs[0] & (15 << 8)) >> 8, (regs[0] & (15 << 4)) >> 4, regs[0] & 15 ); + + model = get_processor_model( regs[0], &stepping, &family ); + swprintf( caption, fmtW, arch, family, model, stepping ); } -static void get_processor_version( WCHAR *version ) +static void get_processor_version( WCHAR *version, UINT len ) { static const WCHAR fmtW[] = {'M','o','d','e','l',' ','%','u',',',' ','S','t','e','p','p','i','n','g',' ','%','u',0}; - unsigned int regs[4] = {0, 0, 0, 0}; + unsigned int regs[4] = {0, 0, 0, 0}, model, stepping; do_cpuid( 1, regs ); - sprintfW( version, fmtW, (regs[0] & (15 << 4)) >> 4, regs[0] & 15 ); + + model = get_processor_model( regs[0], &stepping, NULL ); + swprintf( version, fmtW, model, stepping ); } static UINT16 get_processor_revision(void) { @@ -2866,36 +3718,18 @@ static UINT16 get_processor_revision(void) do_cpuid( 1, regs ); return regs[0]; } -static void get_processor_id( WCHAR *processor_id ) +static void get_processor_id( WCHAR *processor_id, UINT len ) { static const WCHAR fmtW[] = {'%','0','8','X','%','0','8','X',0}; unsigned int regs[4] = {0, 0, 0, 0}; do_cpuid( 1, regs ); - sprintfW( processor_id, fmtW, regs[3], regs[0] ); -} -static void regs_to_str( unsigned int *regs, unsigned int len, WCHAR *buffer ) -{ - unsigned int i; - unsigned char *p = (unsigned char *)regs; - - for (i = 0; i < len; i++) { buffer[i] = *p++; } - buffer[i] = 0; -} -static void get_processor_manufacturer( WCHAR *manufacturer ) -{ - unsigned int tmp, regs[4] = {0, 0, 0, 0}; - - do_cpuid( 0, regs ); - tmp = regs[2]; /* swap edx and ecx */ - regs[2] = regs[3]; - regs[3] = tmp; - - regs_to_str( regs + 1, 12, manufacturer ); + swprintf( processor_id, fmtW, regs[3], regs[0] ); } static void get_processor_name( WCHAR *name ) { unsigned int regs[4] = {0, 0, 0, 0}; + int i; do_cpuid( 0x80000000, regs ); if (regs[0] >= 0x80000004) @@ -2907,6 +3741,7 @@ static void get_processor_name( WCHAR *name ) do_cpuid( 0x80000004, regs ); regs_to_str( regs, 16, name + 32 ); } + for (i = lstrlenW(name) - 1; i >= 0 && name[i] == ' '; i--) name[i] = 0; } static UINT get_processor_currentclockspeed( UINT index ) { @@ -2942,21 +3777,35 @@ static enum fill_status fill_processor( struct table *table, const struct expr * static const WCHAR fmtW[] = {'C','P','U','%','u',0}; WCHAR caption[100], device_id[14], processor_id[17], manufacturer[13], name[49] = {0}, version[50]; struct record_processor *rec; +#ifdef __REACTOS__ UINT i, offset = 0, num_rows = 0, num_cores, num_logical_processors, count = get_processor_count(); +#else + UINT i, offset = 0, num_rows = 0, num_logical, num_physical, num_packages; +#endif enum fill_status status = FILL_STATUS_UNFILTERED; +#ifdef __REACTOS__ if (!resize_table( table, count, sizeof(*rec) )) return FILL_STATUS_FAILED; +#else + num_logical = get_logical_processor_count( &num_physical, &num_packages ); + + if (!resize_table( table, num_packages, sizeof(*rec) )) return FILL_STATUS_FAILED; +#endif - get_processor_caption( caption ); - get_processor_id( processor_id ); - get_processor_manufacturer( manufacturer ); + get_processor_caption( caption, ARRAY_SIZE( caption ) ); + get_processor_id( processor_id, ARRAY_SIZE( processor_id ) ); + get_processor_manufacturer( manufacturer, ARRAY_SIZE( manufacturer ) ); get_processor_name( name ); - get_processor_version( version ); + get_processor_version( version, ARRAY_SIZE( version ) ); +#ifdef __REACTOS__ num_logical_processors = get_logical_processor_count( &num_cores ) / count; num_cores /= count; for (i = 0; i < count; i++) +#else + for (i = 0; i < num_packages; i++) +#endif { rec = (struct record_processor *)(table->data + offset); rec->addresswidth = get_osarchitecture() == os_32bitW ? 32 : 64; @@ -2966,15 +3815,20 @@ static enum fill_status fill_processor( struct table *table, const struct expr * rec->currentclockspeed = get_processor_currentclockspeed( i ); rec->datawidth = get_osarchitecture() == os_32bitW ? 32 : 64; rec->description = heap_strdupW( caption ); - sprintfW( device_id, fmtW, i ); + swprintf( device_id, fmtW, i ); rec->device_id = heap_strdupW( device_id ); rec->family = 2; /* Unknown */ rec->level = 15; rec->manufacturer = heap_strdupW( manufacturer ); rec->maxclockspeed = get_processor_maxclockspeed( i ); rec->name = heap_strdupW( name ); +#ifdef __REACTOS__ rec->num_cores = num_cores; rec->num_logical_processors = num_logical_processors; +#else + rec->num_cores = num_physical / num_packages; + rec->num_logical_processors = num_logical / num_packages; +#endif rec->processor_id = heap_strdupW( processor_id ); rec->processortype = 3; /* central processor */ rec->revision = get_processor_revision(); @@ -3007,7 +3861,7 @@ static WCHAR *get_lastbootuptime(void) NtQuerySystemInformation( SystemTimeOfDayInformation, &ti, sizeof(ti), NULL ); RtlTimeToTimeFields( &ti.liKeBootTime, &tf ); - sprintfW( ret, fmtW, tf.Year, tf.Month, tf.Day, tf.Hour, tf.Minute, tf.Second, tf.Milliseconds * 1000 ); + swprintf( ret, fmtW, tf.Year, tf.Month, tf.Day, tf.Hour, tf.Minute, tf.Second, tf.Milliseconds * 1000 ); return ret; } static WCHAR *get_localdatetime(void) @@ -3032,7 +3886,7 @@ static WCHAR *get_localdatetime(void) if (!(ret = heap_alloc( 26 * sizeof(WCHAR) ))) return NULL; GetLocalTime(&st); - sprintfW( ret, fmtW, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds * 1000, -Bias); + swprintf( ret, fmtW, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds * 1000, -Bias ); return ret; } static WCHAR *get_systemdirectory(void) @@ -3046,11 +3900,18 @@ static WCHAR *get_systemdirectory(void) Wow64RevertWow64FsRedirection( redir ); return ret; } +static WCHAR *get_systemdrive(void) +{ + WCHAR *ret = heap_alloc( 3 * sizeof(WCHAR) ); /* "c:" */ + if (ret && GetEnvironmentVariableW( prop_systemdriveW, ret, 3 )) return ret; + heap_free( ret ); + return NULL; +} static WCHAR *get_codeset(void) { static const WCHAR fmtW[] = {'%','u',0}; WCHAR *ret = heap_alloc( 11 * sizeof(WCHAR) ); - if (ret) sprintfW( ret, fmtW, GetACP() ); + if (ret) swprintf( ret, fmtW, GetACP() ); return ret; } static WCHAR *get_countrycode(void) @@ -3069,7 +3930,7 @@ static WCHAR *get_osbuildnumber( OSVERSIONINFOEXW *ver ) { static const WCHAR fmtW[] = {'%','u',0}; WCHAR *ret = heap_alloc( 11 * sizeof(WCHAR) ); - if (ret) sprintfW( ret, fmtW, ver->dwBuildNumber ); + if (ret) swprintf( ret, fmtW, ver->dwBuildNumber ); return ret; } static WCHAR *get_oscaption( OSVERSIONINFOEXW *ver ) @@ -3130,7 +3991,7 @@ static WCHAR *get_osname( const WCHAR *caption ) static const WCHAR partitionW[] = {'|','C',':','\\','W','I','N','D','O','W','S','|','\\','D','e','v','i','c','e','\\', 'H','a','r','d','d','i','s','k','0','\\','P','a','r','t','i','t','i','o','n','1',0}; - int len = strlenW( caption ); + int len = lstrlenW( caption ); WCHAR *ret; if (!(ret = heap_alloc( len * sizeof(WCHAR) + sizeof(partitionW) ))) return NULL; @@ -3142,12 +4003,29 @@ static WCHAR *get_osversion( OSVERSIONINFOEXW *ver ) { static const WCHAR fmtW[] = {'%','u','.','%','u','.','%','u',0}; WCHAR *ret = heap_alloc( 33 * sizeof(WCHAR) ); - if (ret) sprintfW( ret, fmtW, ver->dwMajorVersion, ver->dwMinorVersion, ver->dwBuildNumber ); + if (ret) swprintf( ret, fmtW, ver->dwMajorVersion, ver->dwMinorVersion, ver->dwBuildNumber ); + return ret; +} +#ifndef __REACTOS__ +static DWORD get_operatingsystemsku(void) +{ + DWORD ret = PRODUCT_UNDEFINED; + GetProductInfo( 6, 0, 0, 0, &ret ); return ret; } +#endif +static INT16 get_currenttimezone(void) +{ + TIME_ZONE_INFORMATION info; + DWORD status = GetTimeZoneInformation( &info ); + if (status == TIME_ZONE_ID_INVALID) return 0; + if (status == TIME_ZONE_ID_DAYLIGHT) return -(info.Bias + info.DaylightBias); + return -(info.Bias + info.StandardBias); +} -static enum fill_status fill_os( struct table *table, const struct expr *cond ) +static enum fill_status fill_operatingsystem( struct table *table, const struct expr *cond ) { + static const WCHAR wineprojectW[] = {'T','h','e',' ','W','i','n','e',' ','P','r','o','j','e','c','t',0}; struct record_operatingsystem *rec; enum fill_status status = FILL_STATUS_UNFILTERED; OSVERSIONINFOEXW ver; @@ -3164,12 +4042,18 @@ static enum fill_status fill_os( struct table *table, const struct expr *cond ) rec->codeset = get_codeset(); rec->countrycode = get_countrycode(); rec->csdversion = ver.szCSDVersion[0] ? heap_strdupW( ver.szCSDVersion ) : NULL; + rec->csname = get_computername(); + rec->currenttimezone = get_currenttimezone(); rec->freephysicalmemory = get_available_physical_memory() / 1024; rec->installdate = os_installdateW; rec->lastbootuptime = get_lastbootuptime(); rec->localdatetime = get_localdatetime(); rec->locale = get_locale(); + rec->manufacturer = wineprojectW; rec->name = get_osname( rec->caption ); +#ifndef __REACTOS__ + rec->operatingsystemsku = get_operatingsystemsku(); +#endif rec->osarchitecture = get_osarchitecture(); rec->oslanguage = GetSystemDefaultLangID(); rec->osproductsuite = 2461140; /* Windows XP Professional */ @@ -3180,6 +4064,7 @@ static enum fill_status fill_os( struct table *table, const struct expr *cond ) rec->servicepackminor = ver.wServicePackMinor; rec->suitemask = 272; /* Single User + Terminal */ rec->systemdirectory = get_systemdirectory(); + rec->systemdrive = get_systemdrive(); rec->totalvirtualmemorysize = get_total_physical_memory() / 1024; rec->totalvisiblememorysize = rec->totalvirtualmemorysize; rec->version = get_osversion( &ver ); @@ -3354,20 +4239,20 @@ static WCHAR *get_accountname( LSA_TRANSLATED_NAME *name ) } static struct array *get_binaryrepresentation( PSID sid, UINT len ) { - struct array *array = heap_alloc( sizeof(struct array) ); - if (array) + struct array *ret; + UINT8 *ptr; + + if (!(ret = heap_alloc( sizeof(*ret) ))) return NULL; + if (!(ptr = heap_alloc( len ))) { - UINT8 *ret = heap_alloc( len ); - if (ret) - { - memcpy( ret, sid, len ); - array->count = len; - array->ptr = ret; - return array; - } - heap_free( array ); + heap_free( ret ); + return NULL; } - return NULL; + memcpy( ptr, sid, len ); + ret->elem_size = sizeof(*ptr); + ret->count = len; + ret->ptr = ptr; + return ret; } static WCHAR *get_referenceddomainname( LSA_REFERENCED_DOMAIN_LIST *domain ) { @@ -3383,11 +4268,11 @@ static const WCHAR *find_sid_str( const struct expr *cond ) left = cond->u.expr.left; right = cond->u.expr.right; - if (left->type == EXPR_PROPVAL && right->type == EXPR_SVAL && !strcmpiW( left->u.propval->name, prop_sidW )) + if (left->type == EXPR_PROPVAL && right->type == EXPR_SVAL && !wcsicmp( left->u.propval->name, prop_sidW )) { ret = right->u.sval; } - else if (left->type == EXPR_SVAL && right->type == EXPR_PROPVAL && !strcmpiW( right->u.propval->name, prop_sidW )) + else if (left->type == EXPR_SVAL && right->type == EXPR_PROPVAL && !wcsicmp( right->u.propval->name, prop_sidW )) { ret = left->u.sval; } @@ -3442,38 +4327,133 @@ static enum fill_status fill_sid( struct table *table, const struct expr *cond ) return FILL_STATUS_FILTERED; } -#ifndef __REACTOS__ +static WCHAR *get_systemenclosure_string( BYTE id, const char *buf, UINT len ) +{ + const struct smbios_header *hdr; + const struct smbios_chassis *chassis; + UINT offset; -static UINT32 get_bits_per_pixel( UINT *hres, UINT *vres ) + if (!(hdr = find_smbios_entry( SMBIOS_TYPE_CHASSIS, buf, len ))) return NULL; + + chassis = (const struct smbios_chassis *)hdr; + offset = (const char *)chassis - buf + chassis->hdr.length; + return get_smbios_string( id, buf, offset, len ); +} + +static WCHAR *get_systemenclosure_manufacturer( const char *buf, UINT len ) { - HDC hdc = GetDC( NULL ); - UINT32 ret; + WCHAR *ret = get_systemenclosure_string( 1, buf, len ); + if (!ret) return heap_strdupW( systemenclosure_manufacturerW ); + return ret; +} - if (!hdc) return 32; - ret = GetDeviceCaps( hdc, BITSPIXEL ); - *hres = GetDeviceCaps( hdc, HORZRES ); - *vres = GetDeviceCaps( hdc, VERTRES ); - ReleaseDC( NULL, hdc ); +static int get_systemenclosure_lockpresent( const char *buf, UINT len ) +{ + const struct smbios_header *hdr; + const struct smbios_chassis *chassis; + + if (!(hdr = find_smbios_entry( SMBIOS_TYPE_CHASSIS, buf, len )) || hdr->length < sizeof(*chassis)) return 0; + + chassis = (const struct smbios_chassis *)hdr; + return (chassis->type & 0x80) ? -1 : 0; +} + +static struct array *dup_array( const struct array *src ) +{ + struct array *dst; + if (!(dst = heap_alloc( sizeof(*dst) ))) return NULL; + if (!(dst->ptr = heap_alloc( src->count * src->elem_size ))) + { + heap_free( dst ); + return NULL; + } + memcpy( dst->ptr, src->ptr, src->count * src->elem_size ); + dst->elem_size = src->elem_size; + dst->count = src->count; + return dst; +} + +static struct array *get_systemenclosure_chassistypes( const char *buf, UINT len ) +{ + const struct smbios_header *hdr; + const struct smbios_chassis *chassis; + struct array *ret = NULL; + UINT16 *types; + + if (!(hdr = find_smbios_entry( SMBIOS_TYPE_CHASSIS, buf, len )) || hdr->length < sizeof(*chassis)) goto done; + chassis = (const struct smbios_chassis *)hdr; + + if (!(ret = heap_alloc( sizeof(*ret) ))) goto done; + if (!(types = heap_alloc( sizeof(*types) ))) + { + heap_free( ret ); + return NULL; + } + types[0] = chassis->type & ~0x80; + + ret->elem_size = sizeof(*types); + ret->count = 1; + ret->ptr = types; + +done: + if (!ret) ret = dup_array( &systemenclosure_chassistypes_array ); return ret; } + +static enum fill_status fill_systemenclosure( struct table *table, const struct expr *cond ) +{ + struct record_systemenclosure *rec; + enum fill_status status = FILL_STATUS_UNFILTERED; + UINT row = 0, len; + char *buf; + + if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED; + + len = GetSystemFirmwareTable( RSMB, 0, NULL, 0 ); + if (!(buf = heap_alloc( len ))) return FILL_STATUS_FAILED; + GetSystemFirmwareTable( RSMB, 0, buf, len ); + + rec = (struct record_systemenclosure *)table->data; + rec->caption = systemenclosure_systemenclosureW; + rec->chassistypes = get_systemenclosure_chassistypes( buf, len ); + rec->description = systemenclosure_systemenclosureW; + rec->lockpresent = get_systemenclosure_lockpresent( buf, len ); + rec->manufacturer = get_systemenclosure_manufacturer( buf, len ); + rec->name = systemenclosure_systemenclosureW; + rec->tag = systemenclosure_tagW; + if (!match_row( table, row, cond, &status )) free_row_values( table, row ); + else row++; + + heap_free( buf ); + + TRACE("created %u rows\n", row); + table->num_rows = row; + return status; +} + +#ifndef __REACTOS__ static WCHAR *get_pnpdeviceid( DXGI_ADAPTER_DESC *desc ) { static const WCHAR fmtW[] = {'P','C','I','\\','V','E','N','_','%','0','4','X','&','D','E','V','_','%','0','4','X', '&','S','U','B','S','Y','S','_','%','0','8','X','&','R','E','V','_','%','0','2','X','\\', '0','&','D','E','A','D','B','E','E','F','&','0','&','D','E','A','D',0}; + UINT len = sizeof(fmtW) + 2; WCHAR *ret; - if (!(ret = heap_alloc( sizeof(fmtW) + 2 * sizeof(WCHAR) ))) return NULL; - sprintfW( ret, fmtW, desc->VendorId, desc->DeviceId, desc->SubSysId, desc->Revision ); + if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL; + swprintf( ret, fmtW, desc->VendorId, desc->DeviceId, desc->SubSysId, desc->Revision ); return ret; } +#endif #define HW_VENDOR_AMD 0x1002 #define HW_VENDOR_NVIDIA 0x10de #define HW_VENDOR_VMWARE 0x15ad #define HW_VENDOR_INTEL 0x8086 +#ifndef __REACTOS__ + static const WCHAR *get_installeddriver( UINT vendorid ) { static const WCHAR driver_amdW[] = {'a','t','i','c','f','x','3','2','.','d','l','l',0}; @@ -3528,7 +4508,7 @@ done: rec->availability = 3; /* Running or Full Power */ rec->config_errorcode = 0; /* no error */ rec->caption = heap_strdupW( name ); - rec->current_bitsperpixel = get_bits_per_pixel( &hres, &vres ); + rec->current_bitsperpixel = get_bitsperpixel( &hres, &vres ); rec->current_horizontalres = hres; rec->current_refreshrate = 0; /* default refresh rate */ rec->current_scanmode = 2; /* Unknown */ @@ -3543,7 +4523,7 @@ done: rec->status = videocontroller_statusW; rec->videoarchitecture = 2; /* Unknown */ rec->videomemorytype = 2; /* Unknown */ - wsprintfW( mode, fmtW, hres, vres, (UINT64)1 << rec->current_bitsperpixel ); + swprintf( mode, fmtW, hres, vres, (UINT64)1 << rec->current_bitsperpixel ); rec->videomodedescription = heap_strdupW( mode ); rec->videoprocessor = heap_strdupW( name ); if (!match_row( table, row, cond, &status )) free_row_values( table, row ); @@ -3559,44 +4539,54 @@ done: #endif /* !__REACTOS__ */ +#define C(c) sizeof(c)/sizeof(c[0]), c +#define D(d) sizeof(d)/sizeof(d[0]), 0, (BYTE *)d static struct table builtin_classes[] = { - { class_baseboardW, ARRAY_SIZE(col_baseboard), col_baseboard, ARRAY_SIZE(data_baseboard), 0, (BYTE *)data_baseboard }, - { class_biosW, ARRAY_SIZE(col_bios), col_bios, ARRAY_SIZE(data_bios), 0, (BYTE *)data_bios }, - { class_cdromdriveW, ARRAY_SIZE(col_cdromdrive), col_cdromdrive, 0, 0, NULL, fill_cdromdrive }, - { class_compsysW, ARRAY_SIZE(col_compsys), col_compsys, 0, 0, NULL, fill_compsys }, - { class_compsysproductW, ARRAY_SIZE(col_compsysproduct), col_compsysproduct, 0, 0, NULL, fill_compsysproduct }, - { class_datafileW, ARRAY_SIZE(col_datafile), col_datafile, 0, 0, NULL, fill_datafile }, - { class_desktopmonitorW, ARRAY_SIZE(col_desktopmonitor), col_desktopmonitor, 0, 0, NULL, fill_desktopmonitor }, - { class_directoryW, ARRAY_SIZE(col_directory), col_directory, 0, 0, NULL, fill_directory }, - { class_diskdriveW, ARRAY_SIZE(col_diskdrive), col_diskdrive, 0, 0, NULL, fill_diskdrive }, - { class_diskpartitionW, ARRAY_SIZE(col_diskpartition), col_diskpartition, 0, 0, NULL, fill_diskpartition }, - { class_ip4routetableW, ARRAY_SIZE(col_ip4routetable), col_ip4routetable, 0, 0, NULL, fill_ip4routetable }, - { class_logicaldiskW, ARRAY_SIZE(col_logicaldisk), col_logicaldisk, 0, 0, NULL, fill_logicaldisk }, - { class_logicaldisk2W, ARRAY_SIZE(col_logicaldisk), col_logicaldisk, 0, 0, NULL, fill_logicaldisk }, - { class_networkadapterW, ARRAY_SIZE(col_networkadapter), col_networkadapter, 0, 0, NULL, fill_networkadapter }, - { class_networkadapterconfigW, ARRAY_SIZE(col_networkadapterconfig), col_networkadapterconfig, 0, 0, NULL, fill_networkadapterconfig }, - { class_osW, ARRAY_SIZE(col_os), col_os, 0, 0, NULL, fill_os }, - { class_paramsW, ARRAY_SIZE(col_param), col_param, ARRAY_SIZE(data_param), 0, (BYTE *)data_param }, - { class_physicalmediaW, ARRAY_SIZE(col_physicalmedia), col_physicalmedia, ARRAY_SIZE(data_physicalmedia), 0, (BYTE *)data_physicalmedia }, - { class_physicalmemoryW, ARRAY_SIZE(col_physicalmemory), col_physicalmemory, 0, 0, NULL, fill_physicalmemory }, - { class_pnpentityW, ARRAY_SIZE(col_pnpentity), col_pnpentity, 0, 0, NULL, fill_pnpentity }, - { class_printerW, ARRAY_SIZE(col_printer), col_printer, 0, 0, NULL, fill_printer }, - { class_processW, ARRAY_SIZE(col_process), col_process, 0, 0, NULL, fill_process }, - { class_processorW, ARRAY_SIZE(col_processor), col_processor, 0, 0, NULL, fill_processor }, - { class_processor2W, ARRAY_SIZE(col_processor), col_processor, 0, 0, NULL, fill_processor }, - { class_qualifiersW, ARRAY_SIZE(col_qualifier), col_qualifier, ARRAY_SIZE(data_qualifier), 0, (BYTE *)data_qualifier }, - { class_serviceW, ARRAY_SIZE(col_service), col_service, 0, 0, NULL, fill_service }, - { class_sidW, ARRAY_SIZE(col_sid), col_sid, 0, 0, NULL, fill_sid }, - { class_sounddeviceW, ARRAY_SIZE(col_sounddevice), col_sounddevice, ARRAY_SIZE(data_sounddevice), 0, (BYTE *)data_sounddevice }, - { class_stdregprovW, ARRAY_SIZE(col_stdregprov), col_stdregprov, ARRAY_SIZE(data_stdregprov), 0, (BYTE *)data_stdregprov }, - { class_systemsecurityW, ARRAY_SIZE(col_systemsecurity), col_systemsecurity, ARRAY_SIZE(data_systemsecurity), 0, (BYTE *)data_systemsecurity }, - { class_systemenclosureW, ARRAY_SIZE(col_systemenclosure), col_systemenclosure, ARRAY_SIZE(data_systemenclosure), 0, (BYTE *)data_systemenclosure }, + { class_associatorsW, C(col_associator), D(data_associator) }, + { class_baseboardW, C(col_baseboard), 0, 0, NULL, fill_baseboard }, + { class_biosW, C(col_bios), 0, 0, NULL, fill_bios }, + { class_cdromdriveW, C(col_cdromdrive), 0, 0, NULL, fill_cdromdrive }, + { class_compsysW, C(col_compsys), 0, 0, NULL, fill_compsys }, + { class_compsysproductW, C(col_compsysproduct), 0, 0, NULL, fill_compsysproduct }, + { class_datafileW, C(col_datafile), 0, 0, NULL, fill_datafile }, + { class_desktopmonitorW, C(col_desktopmonitor), 0, 0, NULL, fill_desktopmonitor }, + { class_directoryW, C(col_directory), 0, 0, NULL, fill_directory }, + { class_diskdriveW, C(col_diskdrive), 0, 0, NULL, fill_diskdrive }, + { class_diskdrivetodiskpartitionW, C(col_diskdrivetodiskpartition), 0, 0, NULL, fill_diskdrivetodiskpartition }, + { class_diskpartitionW, C(col_diskpartition), 0, 0, NULL, fill_diskpartition }, + { class_displaycontrollerconfigW, C(col_displaycontrollerconfig), 0, 0, NULL, fill_displaycontrollerconfig }, + { class_ip4routetableW, C(col_ip4routetable), 0, 0, NULL, fill_ip4routetable }, + { class_logicaldiskW, C(col_logicaldisk), 0, 0, NULL, fill_logicaldisk }, + { class_logicaldisk2W, C(col_logicaldisk), 0, 0, NULL, fill_logicaldisk }, + { class_logicaldisktopartitionW, C(col_logicaldisktopartition), 0, 0, NULL, fill_logicaldisktopartition }, + { class_networkadapterW, C(col_networkadapter), 0, 0, NULL, fill_networkadapter }, + { class_networkadapterconfigW, C(col_networkadapterconfig), 0, 0, NULL, fill_networkadapterconfig }, + { class_operatingsystemW, C(col_operatingsystem), 0, 0, NULL, fill_operatingsystem }, + { class_paramsW, C(col_param), D(data_param) }, + { class_physicalmediaW, C(col_physicalmedia), D(data_physicalmedia) }, + { class_physicalmemoryW, C(col_physicalmemory), 0, 0, NULL, fill_physicalmemory }, + { class_pnpentityW, C(col_pnpentity), 0, 0, NULL, fill_pnpentity }, + { class_printerW, C(col_printer), 0, 0, NULL, fill_printer }, + { class_processW, C(col_process), 0, 0, NULL, fill_process }, + { class_processorW, C(col_processor), 0, 0, NULL, fill_processor }, + { class_processor2W, C(col_processor), 0, 0, NULL, fill_processor }, + { class_qualifiersW, C(col_qualifier), D(data_qualifier) }, + { class_quickfixengineeringW, C(col_quickfixengineering), D(data_quickfixengineering) }, + { class_serviceW, C(col_service), 0, 0, NULL, fill_service }, + { class_sidW, C(col_sid), 0, 0, NULL, fill_sid }, + { class_sounddeviceW, C(col_sounddevice), D(data_sounddevice) }, + { class_stdregprovW, C(col_stdregprov), D(data_stdregprov) }, + { class_systemsecurityW, C(col_systemsecurity), D(data_systemsecurity) }, + { class_systemenclosureW, C(col_systemenclosure), 0, 0, NULL, fill_systemenclosure }, #ifndef __REACTOS__ /* Requires dxgi.dll */ - { class_videocontrollerW, ARRAY_SIZE(col_videocontroller), col_videocontroller, 0, 0, NULL, fill_videocontroller } + { class_videocontrollerW, C(col_videocontroller), 0, 0, NULL, fill_videocontroller }, #endif + { class_winsatW, C(col_winsat), D(data_winsat) }, }; +#undef C +#undef D void init_table_list( void ) { diff --git a/dll/win32/wbemprox/class.c b/dll/win32/wbemprox/class.c index a0052047911..8000774c65d 100644 --- a/dll/win32/wbemprox/class.c +++ b/dll/win32/wbemprox/class.c @@ -18,8 +18,10 @@ #define COBJMACROS -#include "config.h" #include <stdarg.h> +#ifdef __REACTOS__ +#include <wchar.h> +#endif #include "windef.h" #include "winbase.h" @@ -114,6 +116,7 @@ static HRESULT WINAPI enum_class_object_Next( { struct enum_class_object *ec = impl_from_IEnumWbemClassObject( iface ); struct view *view = ec->query->view; + struct table *table; static int once = 0; HRESULT hr; @@ -124,14 +127,15 @@ static HRESULT WINAPI enum_class_object_Next( if (lTimeout != WBEM_INFINITE && !once++) FIXME("timeout not supported\n"); *puReturned = 0; - if (ec->index >= view->count) return WBEM_S_FALSE; + if (ec->index >= view->result_count) return WBEM_S_FALSE; - hr = create_class_object( view->table->name, iface, ec->index, NULL, apObjects ); + table = get_view_table( view, ec->index ); + hr = create_class_object( table->name, iface, ec->index, NULL, apObjects ); if (hr != S_OK) return hr; ec->index++; *puReturned = 1; - if (ec->index == view->count && uCount > 1) return WBEM_S_FALSE; + if (ec->index == view->result_count && uCount > 1) return WBEM_S_FALSE; if (uCount > 1) return WBEM_S_TIMEDOUT; return WBEM_S_NO_ERROR; } @@ -169,11 +173,11 @@ static HRESULT WINAPI enum_class_object_Skip( if (lTimeout != WBEM_INFINITE && !once++) FIXME("timeout not supported\n"); - if (!view->count) return WBEM_S_FALSE; + if (!view->result_count) return WBEM_S_FALSE; - if (nCount > view->count - ec->index) + if (nCount > view->result_count - ec->index) { - ec->index = view->count - 1; + ec->index = view->result_count - 1; return WBEM_S_FALSE; } ec->index += nCount; @@ -226,7 +230,6 @@ static struct record *create_record( struct table *table ) for (i = 0; i < table->num_cols; i++) { record->fields[i].type = table->columns[i].type; - record->fields[i].vartype = table->columns[i].vartype; record->fields[i].u.ival = 0; } record->count = table->num_cols; @@ -236,13 +239,11 @@ static struct record *create_record( struct table *table ) void destroy_array( struct array *array, CIMTYPE type ) { - UINT i, size; - + UINT i; if (!array) return; - if (type == CIM_STRING || type == CIM_DATETIME) + if (type == CIM_STRING || type == CIM_DATETIME || type == CIM_REFERENCE) { - size = get_type_size( type ); - for (i = 0; i < array->count; i++) heap_free( *(WCHAR **)((char *)array->ptr + i * size) ); + for (i = 0; i < array->count; i++) heap_free( *(WCHAR **)((char *)array->ptr + i * array->elem_size) ); } heap_free( array->ptr ); heap_free( array ); @@ -256,8 +257,9 @@ static void destroy_record( struct record *record ) release_table( record->table ); for (i = 0; i < record->count; i++) { - if (record->fields[i].type == CIM_STRING || record->fields[i].type == CIM_DATETIME) - heap_free( record->fields[i].u.sval ); + if (record->fields[i].type == CIM_STRING || + record->fields[i].type == CIM_DATETIME || + record->fields[i].type == CIM_REFERENCE) heap_free( record->fields[i].u.sval ); else if (record->fields[i].type & CIM_FLAG_ARRAY) destroy_array( record->fields[i].u.aval, record->fields[i].type & CIM_TYPE_MASK ); } @@ -338,19 +340,22 @@ static HRESULT WINAPI class_object_GetQualifierSet( IWbemClassObject *iface, IWbemQualifierSet **ppQualSet ) { - FIXME("%p, %p\n", iface, ppQualSet); - return E_NOTIMPL; + struct class_object *co = impl_from_IWbemClassObject( iface ); + + TRACE("%p, %p\n", iface, ppQualSet); + + return WbemQualifierSet_create( co->name, NULL, (void **)ppQualSet ); } static HRESULT record_get_value( const struct record *record, UINT index, VARIANT *var, CIMTYPE *type ) { - VARTYPE vartype = record->fields[index].vartype; + VARTYPE vartype = to_vartype( record->fields[index].type & CIM_TYPE_MASK ); if (type) *type = record->fields[index].type; if (record->fields[index].type & CIM_FLAG_ARRAY) { - V_VT( var ) = vartype ? vartype : to_vartype( record->fields[index].type & CIM_TYPE_MASK ) | VT_ARRAY; + V_VT( var ) = vartype | VT_ARRAY; V_ARRAY( var ) = to_safearray( record->fields[index].u.aval, record->fields[index].type & CIM_TYPE_MASK ); return S_OK; } @@ -358,15 +363,13 @@ static HRESULT record_get_value( const struct record *record, UINT index, VARIAN { case CIM_STRING: case CIM_DATETIME: - if (!vartype) vartype = VT_BSTR; + case CIM_REFERENCE: V_BSTR( var ) = SysAllocString( record->fields[index].u.sval ); break; case CIM_SINT32: - if (!vartype) vartype = VT_I4; V_I4( var ) = record->fields[index].u.ival; break; case CIM_UINT32: - if (!vartype) vartype = VT_UI4; V_UI4( var ) = record->fields[index].u.ival; break; default: @@ -419,6 +422,7 @@ static HRESULT record_set_value( struct record *record, UINT index, VARIANT *var { case CIM_STRING: case CIM_DATETIME: + case CIM_REFERENCE: record->fields[index].u.sval = (WCHAR *)(INT_PTR)val; return S_OK; case CIM_SINT16: @@ -488,7 +492,7 @@ static HRESULT WINAPI class_object_GetNames( if (wszQualifierName || pQualifierVal) FIXME("qualifier not supported\n"); - return get_properties( ec->query->view, lFlags, pNames ); + return get_properties( ec->query->view, co->index, lFlags, pNames ); } static HRESULT WINAPI class_object_BeginEnumeration( @@ -516,17 +520,18 @@ static HRESULT WINAPI class_object_Next( struct class_object *obj = impl_from_IWbemClassObject( iface ); struct enum_class_object *iter = impl_from_IEnumWbemClassObject( obj->iter ); struct view *view = iter->query->view; + struct table *table = get_view_table( view, obj->index ); BSTR prop; HRESULT hr; UINT i; TRACE("%p, %08x, %p, %p, %p, %p\n", iface, lFlags, strName, pVal, pType, plFlavor); - for (i = obj->index_property; i < view->table->num_cols; i++) + for (i = obj->index_property; i < table->num_cols; i++) { - if (is_method( view->table, i )) continue; - if (!is_selected_prop( view, view->table->columns[i].name )) continue; - if (!(prop = SysAllocString( view->table->columns[i].name ))) return E_OUTOFMEMORY; + if (is_method( table, i )) continue; + if (!is_result_prop( view, table->columns[i].name )) continue; + if (!(prop = SysAllocString( table->columns[i].name ))) return E_OUTOFMEMORY; if ((hr = get_propval( view, obj->index, prop, pVal, pType, plFlavor )) != S_OK) { SysFreeString( prop ); @@ -586,7 +591,7 @@ static BSTR get_body_text( const struct table *table, UINT row, UINT *len ) if ((value = get_value_bstr( table, row, i ))) { *len += ARRAY_SIZE( fmtW ); - *len += strlenW( table->columns[i].name ); + *len += lstrlenW( table->columns[i].name ); *len += SysStringLen( value ); SysFreeString( value ); } @@ -597,7 +602,7 @@ static BSTR get_body_text( const struct table *table, UINT row, UINT *len ) { if ((value = get_value_bstr( table, row, i ))) { - p += sprintfW( p, fmtW, table->columns[i].name, value ); + p += swprintf( p, fmtW, table->columns[i].name, value ); SysFreeString( value ); } } @@ -609,15 +614,16 @@ static BSTR get_object_text( const struct view *view, UINT index ) static const WCHAR fmtW[] = {'\n','i','n','s','t','a','n','c','e',' ','o','f',' ','%','s','\n','{','%','s','\n','}',';',0}; UINT len, len_body, row = view->result[index]; + struct table *table = get_view_table( view, index ); BSTR ret, body; len = ARRAY_SIZE( fmtW ); - len += strlenW( view->table->name ); - if (!(body = get_body_text( view->table, row, &len_body ))) return NULL; + len += lstrlenW( table->name ); + if (!(body = get_body_text( table, row, &len_body ))) return NULL; len += len_body; if (!(ret = SysAllocStringLen( NULL, len ))) return NULL; - sprintfW( ret, fmtW, view->table->name, body ); + swprintf( ret, fmtW, table->name, body ); SysFreeString( body ); return ret; } @@ -657,12 +663,12 @@ static HRESULT WINAPI class_object_SpawnInstance( { struct class_object *co = impl_from_IWbemClassObject( iface ); struct enum_class_object *ec = impl_from_IEnumWbemClassObject( co->iter ); - struct view *view = ec->query->view; + struct table *table = get_view_table( ec->query->view, co->index ); struct record *record; TRACE("%p, %08x, %p\n", iface, lFlags, ppNewInstance); - if (!(record = create_record( view->table ))) return E_OUTOFMEMORY; + if (!(record = create_record( table ))) return E_OUTOFMEMORY; return create_class_object( co->name, NULL, 0, record, ppNewInstance ); } @@ -728,7 +734,6 @@ static HRESULT create_signature_columns_and_data( IEnumWbemClassObject *iter, UI { static const WCHAR parameterW[] = {'P','a','r','a','m','e','t','e','r',0}; static const WCHAR typeW[] = {'T','y','p','e',0}; - static const WCHAR varianttypeW[] = {'V','a','r','i','a','n','t','T','y','p','e',0}; static const WCHAR defaultvalueW[] = {'D','e','f','a','u','l','t','V','a','l','u','e',0}; struct column *columns; BYTE *row; @@ -757,10 +762,6 @@ static HRESULT create_signature_columns_and_data( IEnumWbemClassObject *iter, UI if (hr != S_OK) goto error; columns[i].type = V_UI4( &val ); - hr = IWbemClassObject_Get( param, varianttypeW, 0, &val, NULL, NULL ); - if (hr != S_OK) goto error; - columns[i].vartype = V_UI4( &val ); - hr = IWbemClassObject_Get( param, defaultvalueW, 0, &val, NULL, NULL ); if (hr != S_OK) goto error; if (V_UI4( &val )) set_default_value( columns[i].type, V_UI4( &val ), row + offset ); @@ -807,12 +808,12 @@ static WCHAR *build_signature_table_name( const WCHAR *class, const WCHAR *metho static const WCHAR fmtW[] = {'_','_','%','s','_','%','s','_','%','s',0}; static const WCHAR outW[] = {'O','U','T',0}; static const WCHAR inW[] = {'I','N',0}; - UINT len = ARRAY_SIZE(fmtW) + ARRAY_SIZE(outW) + strlenW( class ) + strlenW( method ); + UINT len = ARRAY_SIZE(fmtW) + ARRAY_SIZE(outW) + lstrlenW( class ) + lstrlenW( method ); WCHAR *ret; if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL; - sprintfW( ret, fmtW, class, method, dir == PARAM_IN ? inW : outW ); - return struprW( ret ); + swprintf( ret, fmtW, class, method, dir == PARAM_IN ? inW : outW ); + return _wcsupr( ret ); } HRESULT create_signature( const WCHAR *class, const WCHAR *method, enum param_direction dir, @@ -831,9 +832,9 @@ HRESULT create_signature( const WCHAR *class, const WCHAR *method, enum param_di WCHAR *query, *name; HRESULT hr; - len += strlenW( class ) + strlenW( method ); + len += lstrlenW( class ) + lstrlenW( method ); if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY; - sprintfW( query, selectW, class, method, dir >= 0 ? geW : leW ); + swprintf( query, selectW, class, method, dir >= 0 ? geW : leW ); hr = exec_query( query, &iter ); heap_free( query ); diff --git a/dll/win32/wbemprox/main.c b/dll/win32/wbemprox/main.c index e6ccd5c21c0..d90f4f8cc63 100644 --- a/dll/win32/wbemprox/main.c +++ b/dll/win32/wbemprox/main.c @@ -17,8 +17,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" - #include <stdarg.h> #define COBJMACROS diff --git a/dll/win32/wbemprox/precomp.h b/dll/win32/wbemprox/precomp.h index 54f2817c4c0..91403f2cc2f 100644 --- a/dll/win32/wbemprox/precomp.h +++ b/dll/win32/wbemprox/precomp.h @@ -2,8 +2,6 @@ #ifndef _WBEMPROX_PRECOMP_H_ #define _WBEMPROX_PRECOMP_H_ -#include <wine/config.h> - #include <stdarg.h> #define _INC_WINDOWS diff --git a/dll/win32/wbemprox/process.c b/dll/win32/wbemprox/process.c index 6bc3f37529f..de9b03f7089 100644 --- a/dll/win32/wbemprox/process.c +++ b/dll/win32/wbemprox/process.c @@ -20,7 +20,6 @@ #define COBJMACROS -#include "config.h" #include <stdarg.h> #include "windef.h" diff --git a/dll/win32/wbemprox/qualifier.c b/dll/win32/wbemprox/qualifier.c index 06dcc59e318..7243a2d69d5 100644 --- a/dll/win32/wbemprox/qualifier.c +++ b/dll/win32/wbemprox/qualifier.c @@ -18,8 +18,10 @@ #define COBJMACROS -#include "config.h" #include <stdarg.h> +#ifdef __REACTOS__ +#include <wchar.h> +#endif #include "windef.h" #include "winbase.h" @@ -102,19 +104,32 @@ static HRESULT create_qualifier_enum( const WCHAR *class, const WCHAR *member, c {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','_','_','Q','U','A','L', 'I','F','I','E','R','S',' ','W','H','E','R','E',' ','C','l','a','s','s','=', '\'','%','s','\'',' ','A','N','D',' ','M','e','m','b','e','r','=','\'','%','s','\'',0}; - static const WCHAR noneW[] = {'_','_','N','O','N','E',0}; + static const WCHAR fmt3W[] = + {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','_','_','Q','U','A','L', + 'I','F','I','E','R','S',' ','W','H','E','R','E',' ','C','l','a','s','s','=', + '\'','%','s','\'',0}; WCHAR *query; HRESULT hr; int len; - if (!member) member = noneW; - len = strlenW( class ) + strlenW( member ); - if (name) len += strlenW( name ) + ARRAY_SIZE(fmtW); - else len += ARRAY_SIZE(fmt2W); - - if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY; - if (name) sprintfW( query, fmtW, class, member, name ); - else sprintfW( query, fmt2W, class, member ); + if (member && name) + { + len = lstrlenW( class ) + lstrlenW( member ) + lstrlenW( name ) + ARRAY_SIZE(fmtW); + if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY; + swprintf( query, fmtW, class, member, name ); + } + else if (member) + { + len = lstrlenW( class ) + lstrlenW( member ) + ARRAY_SIZE(fmt2W); + if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY; + swprintf( query, fmt2W, class, member ); + } + else + { + len = lstrlenW( class ) + ARRAY_SIZE(fmt3W); + if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY; + swprintf( query, fmt3W, class ); + } hr = exec_query( query, iter ); heap_free( query ); @@ -124,9 +139,9 @@ static HRESULT create_qualifier_enum( const WCHAR *class, const WCHAR *member, c static HRESULT get_qualifier_value( const WCHAR *class, const WCHAR *member, const WCHAR *name, VARIANT *val, LONG *flavor ) { - static const WCHAR qualifiersW[] = {'_','_','Q','U','A','L','I','F','I','E','R','S',0}; static const WCHAR intvalueW[] = {'I','n','t','e','g','e','r','V','a','l','u','e',0}; static const WCHAR strvalueW[] = {'S','t','r','i','n','g','V','a','l','u','e',0}; + static const WCHAR boolvalueW[] = {'B','o','o','l','V','a','l','u','e',0}; static const WCHAR flavorW[] = {'F','l','a','v','o','r',0}; static const WCHAR typeW[] = {'T','y','p','e',0}; IEnumWbemClassObject *iter; @@ -137,7 +152,7 @@ static HRESULT get_qualifier_value( const WCHAR *class, const WCHAR *member, con hr = create_qualifier_enum( class, member, name, &iter ); if (FAILED( hr )) return hr; - hr = create_class_object( qualifiersW, iter, 0, NULL, &obj ); + hr = create_class_object( NULL, iter, 0, NULL, &obj ); IEnumWbemClassObject_Release( iter ); if (FAILED( hr )) return hr; @@ -157,6 +172,9 @@ static HRESULT get_qualifier_value( const WCHAR *class, const WCHAR *member, con case CIM_SINT32: hr = IWbemClassObject_Get( obj, intvalueW, 0, val, NULL, NULL ); break; + case CIM_BOOLEAN: + hr = IWbemClassObject_Get( obj, boolvalueW, 0, val, NULL, NULL ); + break; default: ERR("unhandled type %u\n", V_UI4( &var )); break; @@ -176,7 +194,12 @@ static HRESULT WINAPI qualifier_set_Get( { struct qualifier_set *set = impl_from_IWbemQualifierSet( iface ); - FIXME("%p, %s, %08x, %p, %p\n", iface, debugstr_w(wszName), lFlags, pVal, plFlavor); + TRACE("%p, %s, %08x, %p, %p\n", iface, debugstr_w(wszName), lFlags, pVal, plFlavor); + if (lFlags) + { + FIXME("flags %08x not supported\n", lFlags); + return E_NOTIMPL; + } return get_qualifier_value( set->class, set->member, wszName, pVal, plFlavor ); } @@ -203,8 +226,28 @@ static HRESULT WINAPI qualifier_set_GetNames( LONG lFlags, SAFEARRAY **pNames ) { - FIXME("%p, %08x, %p\n", iface, lFlags, pNames); - return E_NOTIMPL; + struct qualifier_set *set = impl_from_IWbemQualifierSet( iface ); + IEnumWbemClassObject *iter; + IWbemClassObject *obj; + HRESULT hr; + + TRACE("%p, %08x, %p\n", iface, lFlags, pNames); + if (lFlags) + { + FIXME("flags %08x not supported\n", lFlags); + return E_NOTIMPL; + } + + hr = create_qualifier_enum( set->class, set->member, NULL, &iter ); + if (FAILED( hr )) return hr; + + hr = create_class_object( NULL, iter, 0, NULL, &obj ); + IEnumWbemClassObject_Release( iter ); + if (FAILED( hr )) return hr; + + hr = IWbemClassObject_GetNames( obj, NULL, 0, NULL, pNames ); + IWbemClassObject_Release( obj ); + return hr; } static HRESULT WINAPI qualifier_set_BeginEnumeration( diff --git a/dll/win32/wbemprox/query.c b/dll/win32/wbemprox/query.c index d193574a393..85c93792bd0 100644 --- a/dll/win32/wbemprox/query.c +++ b/dll/win32/wbemprox/query.c @@ -18,8 +18,10 @@ #define COBJMACROS -#include "config.h" #include <stdarg.h> +#ifdef __REACTOS__ +#include <wchar.h> +#endif #include "windef.h" #include "winbase.h" @@ -30,25 +32,60 @@ WINE_DEFAULT_DEBUG_CHANNEL(wbemprox); -HRESULT create_view( const struct property *proplist, const WCHAR *class, - const struct expr *cond, struct view **ret ) +static HRESULT append_table( struct view *view, struct table *table ) { - struct view *view = heap_alloc( sizeof(struct view) ); + struct table **tmp; + if (!(tmp = heap_realloc( view->table, (view->table_count + 1) * sizeof(*tmp) ))) return E_OUTOFMEMORY; + view->table = tmp; + view->table[view->table_count++] = table; + return S_OK; +} + +HRESULT create_view( enum view_type type, const WCHAR *path, const struct keyword *keywordlist, const WCHAR *class, + const struct property *proplist, const struct expr *cond, struct view **ret ) +{ + struct view *view = heap_alloc_zero( sizeof(*view) ); if (!view) return E_OUTOFMEMORY; - view->proplist = proplist; - view->table = grab_table( class ); - view->cond = cond; - view->result = NULL; - view->count = 0; + + switch (type) + { + case VIEW_TYPE_ASSOCIATORS: + view->path = path; + view->keywordlist = keywordlist; + break; + + case VIEW_TYPE_SELECT: + { + struct table *table = grab_table( class ); + HRESULT hr; + + if (table && (hr = append_table( view, table )) != S_OK) + { + heap_free( view ); + return hr; + } + view->proplist = proplist; + view->cond = cond; + break; + } + default: + ERR( "unhandled type %u\n", type ); + heap_free( view ); + return E_INVALIDARG; + } + + view->type = type; *ret = view; return S_OK; } void destroy_view( struct view *view ) { + ULONG i; if (!view) return; - if (view->table) release_table( view->table ); + for (i = 0; i < view->table_count; i++) release_table( view->table[i] ); + heap_free( view->table ); heap_free( view->result ); heap_free( view ); } @@ -63,10 +100,10 @@ static BOOL eval_like( const WCHAR *lstr, const WCHAR *rstr ) { while (*q == '%') q++; if (!*q) return TRUE; - while (*p && *q && toupperW( *p ) == toupperW( *q )) { p++; q++; }; + while (*p && *q && towupper( *p ) == towupper( *q )) { p++; q++; }; if (!*p && !*q) return TRUE; } - if (*q != '%' && toupperW( *p++ ) != toupperW( *q++ )) return FALSE; + if (*q != '%' && towupper( *p++ ) != towupper( *q++ )) return FALSE; } return TRUE; } @@ -81,22 +118,22 @@ static HRESULT eval_strcmp( UINT op, const WCHAR *lstr, const WCHAR *rstr, LONGL switch (op) { case OP_EQ: - *val = !strcmpW( lstr, rstr ); + *val = !wcscmp( lstr, rstr ); break; case OP_GT: - *val = strcmpW( lstr, rstr ) > 0; + *val = wcscmp( lstr, rstr ) > 0; break; case OP_LT: - *val = strcmpW( lstr, rstr ) < 0; + *val = wcscmp( lstr, rstr ) < 0; break; case OP_LE: - *val = strcmpW( lstr, rstr ) <= 0; + *val = wcscmp( lstr, rstr ) <= 0; break; case OP_GE: - *val = strcmpW( lstr, rstr ) >= 0; + *val = wcscmp( lstr, rstr ) >= 0; break; case OP_NE: - *val = strcmpW( lstr, rstr ); + *val = wcscmp( lstr, rstr ); break; case OP_LIKE: *val = eval_like( lstr, rstr ); @@ -148,8 +185,8 @@ static HRESULT eval_boolcmp( UINT op, LONGLONG lval, LONGLONG rval, UINT ltype, { static const WCHAR trueW[] = {'T','r','u','e',0}; - if (ltype == CIM_STRING) lval = !strcmpiW( (const WCHAR *)(INT_PTR)lval, trueW ) ? -1 : 0; - else if (rtype == CIM_STRING) rval = !strcmpiW( (const WCHAR *)(INT_PTR)rval, trueW ) ? -1 : 0; + if (ltype == CIM_STRING) lval = !wcsicmp( (const WCHAR *)(INT_PTR)lval, trueW ) ? -1 : 0; + else if (rtype == CIM_STRING) rval = !wcsicmp( (const WCHAR *)(INT_PTR)rval, trueW ) ? -1 : 0; switch (op) { @@ -166,6 +203,35 @@ static HRESULT eval_boolcmp( UINT op, LONGLONG lval, LONGLONG rval, UINT ltype, return S_OK; } +static inline BOOL is_refcmp( const struct complex_expr *expr, UINT ltype, UINT rtype ) +{ + if (ltype == CIM_REFERENCE && expr->left->type == EXPR_PROPVAL && expr->right->type == EXPR_SVAL) return TRUE; + else if (rtype == CIM_REFERENCE && expr->right->type == EXPR_PROPVAL && expr->left->type == EXPR_SVAL) return TRUE; + return FALSE; +} + +static HRESULT eval_refcmp( UINT op, const WCHAR *lstr, const WCHAR *rstr, LONGLONG *val ) +{ + if (!lstr || !rstr) + { + *val = 0; + return S_OK; + } + switch (op) + { + case OP_EQ: + *val = !wcsicmp( lstr, rstr ); + break; + case OP_NE: + *val = wcsicmp( lstr, rstr ); + break; + default: + ERR("unhandled operator %u\n", op); + return WBEM_E_INVALID_QUERY; + } + return S_OK; +} + static UINT resolve_type( UINT left, UINT right ) { switch (left) @@ -201,13 +267,17 @@ static UINT resolve_type( UINT left, UINT right ) if (right == CIM_BOOLEAN) return CIM_BOOLEAN; break; + case CIM_REFERENCE: + if (right == CIM_REFERENCE) return CIM_REFERENCE; + break; + default: break; } return CIM_ILLEGAL; } -static const WCHAR *format_int( WCHAR *buf, CIMTYPE type, LONGLONG val ) +static const WCHAR *format_int( WCHAR *buf, UINT len, CIMTYPE type, LONGLONG val ) { static const WCHAR fmt_signedW[] = {'%','d',0}; static const WCHAR fmt_unsignedW[] = {'%','u',0}; @@ -219,13 +289,13 @@ static const WCHAR *format_int( WCHAR *buf, CIMTYPE type, LONGLONG val ) case CIM_SINT8: case CIM_SINT16: case CIM_SINT32: - sprintfW( buf, fmt_signedW, val ); + swprintf( buf, fmt_signedW, val ); return buf; case CIM_UINT8: case CIM_UINT16: case CIM_UINT32: - sprintfW( buf, fmt_unsignedW, val ); + swprintf( buf, fmt_unsignedW, val ); return buf; case CIM_SINT64: @@ -255,22 +325,28 @@ static HRESULT eval_binary( const struct table *table, UINT row, const struct co *type = resolve_type( ltype, rtype ); - if (is_boolcmp( expr, ltype, rtype )) - return eval_boolcmp( expr->op, lval, rval, ltype, rtype, val ); - if (is_strcmp( expr, ltype, rtype )) { const WCHAR *lstr, *rstr; WCHAR lbuf[21], rbuf[21]; - if (is_int( ltype )) lstr = format_int( lbuf, ltype, lval ); + if (is_int( ltype )) lstr = format_int( lbuf, ARRAY_SIZE( lbuf ), ltype, lval ); else lstr = (const WCHAR *)(INT_PTR)lval; - if (is_int( rtype )) rstr = format_int( rbuf, rtype, rval ); + if (is_int( rtype )) rstr = format_int( rbuf, ARRAY_SIZE( rbuf ), rtype, rval ); else rstr = (const WCHAR *)(INT_PTR)rval; return eval_strcmp( expr->op, lstr, rstr, val ); } + if (is_boolcmp( expr, ltype, rtype )) + { + return eval_boolcmp( expr->op, lval, rval, ltype, rtype, val ); + } + if (is_refcmp( expr, ltype, rtype )) + { + return eval_refcmp( expr->op, (const WCHAR *)(INT_PTR)lval, (const WCHAR *)(INT_PTR)rval, val ); + } + switch (expr->op) { case OP_EQ: @@ -402,22 +478,243 @@ HRESULT eval_cond( const struct table *table, UINT row, const struct expr *cond, return WBEM_E_INVALID_QUERY; } -HRESULT execute_view( struct view *view ) +static WCHAR *build_assoc_query( const WCHAR *class, UINT class_len ) +{ + static const WCHAR fmtW[] = + {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','_','_','A','S','S','O','C','I','A','T','O','R','S', + ' ','W','H','E','R','E',' ','C','l','a','s','s','=','\'','%','s','\'',0}; + UINT len = class_len + ARRAY_SIZE(fmtW); + WCHAR *ret; + + if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL; + swprintf( ret, fmtW, class ); + return ret; +} + +static HRESULT create_assoc_enum( const WCHAR *class, UINT class_len, IEnumWbemClassObject **iter ) +{ + WCHAR *query; + HRESULT hr; + + if (!(query = build_assoc_query( class, class_len ))) return E_OUTOFMEMORY; + hr = exec_query( query, iter ); + heap_free( query ); + return hr; +} + +static WCHAR *build_antecedent_query( const WCHAR *assocclass, const WCHAR *dependent ) +{ + static const WCHAR fmtW[] = + {'S','E','L','E','C','T',' ','A','n','t','e','c','e','d','e','n','t',' ','F','R','O','M',' ','%','s',' ', + 'W','H','E','R','E',' ','D','e','p','e','n','d','e','n','t','=','\'','%','s','\'',0}; + UINT len = lstrlenW(assocclass) + lstrlenW(dependent) + ARRAY_SIZE(fmtW); + WCHAR *ret; + + if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL; + swprintf( ret, fmtW, assocclass, dependent ); + return ret; +} + +static BSTR build_servername(void) +{ + WCHAR server[MAX_COMPUTERNAME_LENGTH + 1], *p; + DWORD len = ARRAY_SIZE( server ); + + if (!(GetComputerNameW( server, &len ))) return NULL; + for (p = server; *p; p++) *p = towupper( *p ); + return SysAllocString( server ); +} + +static BSTR build_namespace(void) +{ + static const WCHAR cimv2W[] = {'R','O','O','T','\\','C','I','M','V','2',0}; + return SysAllocString( cimv2W ); +} + +static WCHAR *build_canonical_path( const WCHAR *relpath ) +{ + static const WCHAR fmtW[] = {'\\','\\','%','s','\\','%','s',':',0}; + BSTR server, namespace; + WCHAR *ret; + UINT len, i; + + if (!(server = build_servername())) return NULL; + if (!(namespace = build_namespace())) + { + SysFreeString( server ); + return NULL; + } + + len = ARRAY_SIZE( fmtW ) + SysStringLen( server ) + SysStringLen( namespace ) + lstrlenW( relpath ); + if ((ret = heap_alloc( len * sizeof(WCHAR ) ))) + { + len = swprintf( ret, fmtW, server, namespace ); + for (i = 0; i < lstrlenW( relpath ); i ++) + { + if (relpath[i] == '\'') ret[len++] = '"'; + else ret[len++] = relpath[i]; + } + ret[len] = 0; + } + + SysFreeString( server ); + SysFreeString( namespace ); + return ret; +} + +static HRESULT get_antecedent( const WCHAR *assocclass, const WCHAR *dependent, BSTR *ret ) +{ + static const WCHAR antecedentW[] = {'A','n','t','e','c','e','d','e','n','t',0}; + WCHAR *fullpath, *str; + IEnumWbemClassObject *iter = NULL; + IWbemClassObject *obj; + HRESULT hr = E_OUTOFMEMORY; + ULONG count; + VARIANT var; + + if (!(fullpath = build_canonical_path( dependent ))) return E_OUTOFMEMORY; + if (!(str = build_antecedent_query( assocclass, fullpath ))) goto done; + if ((hr = exec_query( str, &iter )) != S_OK) goto done; + + IEnumWbemClassObject_Next( iter, WBEM_INFINITE, 1, &obj, &count ); + if (!count) + { + *ret = NULL; + goto done; + } + + hr = IWbemClassObject_Get( obj, antecedentW, 0, &var, NULL, NULL ); + IWbemClassObject_Release( obj ); + if (hr != S_OK) goto done; + *ret = V_BSTR( &var ); + +done: + if (iter) IEnumWbemClassObject_Release( iter ); + heap_free( str ); + heap_free( fullpath ); + return hr; +} + +static HRESULT do_query( const WCHAR *str, struct query **ret_query ) +{ + struct query *query; + HRESULT hr; + + if (!(query = create_query())) return E_OUTOFMEMORY; + if ((hr = parse_query( str, &query->view, &query->mem )) != S_OK || (hr = execute_view( query->view )) != S_OK) + { + release_query( query ); + return hr; + } + *ret_query = query; + return S_OK; +} + +static HRESULT get_antecedent_table( const WCHAR *assocclass, const WCHAR *dependent, struct table **table ) +{ + BSTR antecedent = NULL; + struct path *path = NULL; + WCHAR *str = NULL; + struct query *query = NULL; + HRESULT hr; + + if ((hr = get_antecedent( assocclass, dependent, &antecedent )) != S_OK) return hr; + if (!antecedent) + { + *table = NULL; + return S_OK; + } + if ((hr = parse_path( antecedent, &path )) != S_OK) goto done; + if (!(str = query_from_path( path ))) + { + hr = E_OUTOFMEMORY; + goto done; + } + + if ((hr = do_query( str, &query )) != S_OK) goto done; + if (query->view->table_count) *table = addref_table( query->view->table[0] ); + else *table = NULL; + +done: + if (query) release_query( query ); + free_path( path ); + SysFreeString( antecedent ); + heap_free( str ); + return hr; +} + +static HRESULT exec_assoc_view( struct view *view ) +{ + static const WCHAR assocclassW[] = {'A','s','s','o','c','C','l','a','s','s',0}; + IEnumWbemClassObject *iter = NULL; + struct path *path; + HRESULT hr; + + if (view->keywordlist) FIXME( "ignoring keywords\n" ); + if ((hr = parse_path( view->path, &path )) != S_OK) return hr; + + if ((hr = create_assoc_enum( path->class, path->class_len, &iter )) != S_OK) goto done; + for (;;) + { + ULONG count; + IWbemClassObject *obj; + struct table *table; + VARIANT var; + + IEnumWbemClassObject_Next( iter, WBEM_INFINITE, 1, &obj, &count ); + if (!count) break; + + if ((hr = IWbemClassObject_Get( obj, assocclassW, 0, &var, NULL, NULL )) != S_OK) + { + IWbemClassObject_Release( obj ); + goto done; + } + IWbemClassObject_Release( obj ); + + hr = get_antecedent_table( V_BSTR(&var), view->path, &table ); + VariantClear( &var ); + if (hr != S_OK) goto done; + + if (table && (hr = append_table( view, table )) != S_OK) + { + release_table( table ); + goto done; + } + } + + if (view->table_count) + { + if (!(view->result = heap_alloc_zero( view->table_count * sizeof(UINT) ))) hr = E_OUTOFMEMORY; + else view->result_count = view->table_count; + } + +done: + if (iter) IEnumWbemClassObject_Release( iter ); + free_path( path ); + return hr; +} + +static HRESULT exec_select_view( struct view *view ) { UINT i, j = 0, len; + enum fill_status status = FILL_STATUS_UNFILTERED; + struct table *table; + + if (!view->table_count) return S_OK; - if (!view->table) return S_OK; - if (view->table->fill) + table = view->table[0]; + if (table->fill) { - clear_table( view->table ); - view->table->fill( view->table, view->cond ); + clear_table( table ); + status = table->fill( table, view->cond ); } - if (!view->table->num_rows) return S_OK; + if (status == FILL_STATUS_FAILED) return WBEM_E_FAILED; + if (!table->num_rows) return S_OK; - len = min( view->table->num_rows, 16 ); + len = min( table->num_rows, 16 ); if (!(view->result = heap_alloc( len * sizeof(UINT) ))) return E_OUTOFMEMORY; - for (i = 0; i < view->table->num_rows; i++) + for (i = 0; i < table->num_rows; i++) { HRESULT hr; LONGLONG val = 0; @@ -430,13 +727,31 @@ HRESULT execute_view( struct view *view ) if (!(tmp = heap_realloc( view->result, len * sizeof(UINT) ))) return E_OUTOFMEMORY; view->result = tmp; } - if ((hr = eval_cond( view->table, i, view->cond, &val, &type )) != S_OK) return hr; + if (status == FILL_STATUS_FILTERED) val = 1; + else if ((hr = eval_cond( table, i, view->cond, &val, &type )) != S_OK) return hr; if (val) view->result[j++] = i; } - view->count = j; + + view->result_count = j; return S_OK; } +HRESULT execute_view( struct view *view ) +{ + switch (view->type) + { + case VIEW_TYPE_ASSOCIATORS: + return exec_assoc_view( view ); + + case VIEW_TYPE_SELECT: + return exec_select_view( view ); + + default: + ERR( "unhandled type %u\n", view->type ); + return E_INVALIDARG; + } +} + struct query *create_query(void) { struct query *query; @@ -486,14 +801,13 @@ done: return hr; } -BOOL is_selected_prop( const struct view *view, const WCHAR *name ) +BOOL is_result_prop( const struct view *view, const WCHAR *name ) { const struct property *prop = view->proplist; - if (!prop) return TRUE; while (prop) { - if (!strcmpiW( prop->name, name )) return TRUE; + if (!wcsicmp( prop->name, name )) return TRUE; prop = prop->next; } return FALSE; @@ -504,61 +818,34 @@ static BOOL is_system_prop( const WCHAR *name ) return (name[0] == '_' && name[1] == '_'); } -static BSTR build_servername( const struct view *view ) -{ - WCHAR server[MAX_COMPUTERNAME_LENGTH + 1], *p; - DWORD len = ARRAY_SIZE( server ); - - if (view->proplist) return NULL; - - if (!(GetComputerNameW( server, &len ))) return NULL; - for (p = server; *p; p++) *p = toupperW( *p ); - return SysAllocString( server ); -} - -static BSTR build_classname( const struct view *view ) -{ - return SysAllocString( view->table->name ); -} - -static BSTR build_namespace( const struct view *view ) -{ - static const WCHAR cimv2W[] = {'R','O','O','T','\\','C','I','M','V','2',0}; - - if (view->proplist) return NULL; - return SysAllocString( cimv2W ); -} - -static BSTR build_proplist( const struct view *view, UINT index, UINT count, UINT *len ) +static BSTR build_proplist( const struct table *table, UINT row, UINT count, UINT *len ) { static const WCHAR fmtW[] = {'%','s','=','%','s',0}; - UINT i, j, offset, row = view->result[index]; + UINT i, j, offset; BSTR *values, ret = NULL; if (!(values = heap_alloc( count * sizeof(BSTR) ))) return NULL; *len = j = 0; - for (i = 0; i < view->table->num_cols; i++) + for (i = 0; i < table->num_cols; i++) { - if (view->table->columns[i].type & COL_FLAG_KEY) + if (table->columns[i].type & COL_FLAG_KEY) { - const WCHAR *name = view->table->columns[i].name; - - values[j] = get_value_bstr( view->table, row, i ); - *len += strlenW( fmtW ) + strlenW( name ) + strlenW( values[j] ); + const WCHAR *name = table->columns[i].name; + values[j] = get_value_bstr( table, row, i ); + *len += lstrlenW( fmtW ) + lstrlenW( name ) + lstrlenW( values[j] ); j++; } } if ((ret = SysAllocStringLen( NULL, *len ))) { offset = j = 0; - for (i = 0; i < view->table->num_cols; i++) + for (i = 0; i < table->num_cols; i++) { - if (view->table->columns[i].type & COL_FLAG_KEY) + if (table->columns[i].type & COL_FLAG_KEY) { - const WCHAR *name = view->table->columns[i].name; - - offset += sprintfW( ret + offset, fmtW, name, values[j] ); + const WCHAR *name = table->columns[i].name; + offset += swprintf( ret + offset, fmtW, name, values[j] ); if (j < count - 1) ret[offset++] = ','; j++; } @@ -569,32 +856,34 @@ static BSTR build_proplist( const struct view *view, UINT index, UINT count, UIN return ret; } -static UINT count_key_columns( const struct view *view ) +static UINT count_key_columns( const struct table *table ) { UINT i, num_keys = 0; - for (i = 0; i < view->table->num_cols; i++) + for (i = 0; i < table->num_cols; i++) { - if (view->table->columns[i].type & COL_FLAG_KEY) num_keys++; + if (table->columns[i].type & COL_FLAG_KEY) num_keys++; } return num_keys; } -static BSTR build_relpath( const struct view *view, UINT index, const WCHAR *name ) +static BSTR build_relpath( const struct view *view, UINT table_index, UINT result_index, const WCHAR *name ) { static const WCHAR fmtW[] = {'%','s','.','%','s',0}; BSTR class, proplist, ret = NULL; + struct table *table = view->table[table_index]; + UINT row = view->result[result_index]; UINT num_keys, len; if (view->proplist) return NULL; - if (!(class = build_classname( view ))) return NULL; - if (!(num_keys = count_key_columns( view ))) return class; - if (!(proplist = build_proplist( view, index, num_keys, &len ))) goto done; + if (!(class = SysAllocString( view->table[table_index]->name ))) return NULL; + if (!(num_keys = count_key_columns( table ))) return class; + if (!(proplist = build_proplist( table, row, num_keys, &len ))) goto done; - len += strlenW( fmtW ) + SysStringLen( class ); + len += lstrlenW( fmtW ) + SysStringLen( class ); if (!(ret = SysAllocStringLen( NULL, len ))) goto done; - sprintfW( ret, fmtW, class, proplist ); + swprintf( ret, fmtW, class, proplist ); done: SysFreeString( class ); @@ -602,7 +891,7 @@ done: return ret; } -static BSTR build_path( const struct view *view, UINT index, const WCHAR *name ) +static BSTR build_path( const struct view *view, UINT table_index, UINT result_index, const WCHAR *name ) { static const WCHAR fmtW[] = {'\\','\\','%','s','\\','%','s',':','%','s',0}; BSTR server, namespace = NULL, relpath = NULL, ret = NULL; @@ -610,13 +899,13 @@ static BSTR build_path( const struct view *view, UINT index, const WCHAR *name ) if (view->proplist) return NULL; - if (!(server = build_servername( view ))) return NULL; - if (!(namespace = build_namespace( view ))) goto done; - if (!(relpath = build_relpath( view, index, name ))) goto done; + if (!(server = build_servername())) return NULL; + if (!(namespace = build_namespace())) goto done; + if (!(relpath = build_relpath( view, table_index, result_index, name ))) goto done; - len = strlenW( fmtW ) + SysStringLen( server ) + SysStringLen( namespace ) + SysStringLen( relpath ); + len = lstrlenW( fmtW ) + SysStringLen( server ) + SysStringLen( namespace ) + SysStringLen( relpath ); if (!(ret = SysAllocStringLen( NULL, len ))) goto done; - sprintfW( ret, fmtW, server, namespace, relpath ); + swprintf( ret, fmtW, server, namespace, relpath ); done: SysFreeString( server ); @@ -630,30 +919,30 @@ BOOL is_method( const struct table *table, UINT column ) return table->columns[column].type & COL_FLAG_METHOD; } -static UINT count_properties( const struct view *view ) +static UINT count_properties( const struct table *table ) { UINT i, num_props = 0; - for (i = 0; i < view->table->num_cols; i++) + for (i = 0; i < table->num_cols; i++) { - if (!is_method( view->table, i)) num_props++; + if (!is_method( table, i )) num_props++; } return num_props; } -static UINT count_selected_properties( const struct view *view ) +static UINT count_result_properties( const struct view *view, UINT table_index ) { const struct property *prop = view->proplist; UINT count; - if (!prop) return count_properties( view ); + if (!prop) return count_properties( view->table[table_index] ); count = 1; while ((prop = prop->next)) count++; return count; } -static HRESULT get_system_propval( const struct view *view, UINT index, const WCHAR *name, +static HRESULT get_system_propval( const struct view *view, UINT table_index, UINT result_index, const WCHAR *name, VARIANT *ret, CIMTYPE *type, LONG *flavor ) { static const WCHAR classW[] = {'_','_','C','L','A','S','S',0}; @@ -666,17 +955,17 @@ static HRESULT get_system_propval( const struct view *view, UINT index, const WC if (flavor) *flavor = WBEM_FLAVOR_ORIGIN_SYSTEM; - if (!strcmpiW( name, classW )) + if (!wcsicmp( name, classW )) { if (ret) { V_VT( ret ) = VT_BSTR; - V_BSTR( ret ) = build_classname( view ); + V_BSTR( ret ) = SysAllocString( view->table[table_index]->name ); } if (type) *type = CIM_STRING; return S_OK; } - if (!strcmpiW( name, genusW )) + if (!wcsicmp( name, genusW )) { if (ret) { @@ -686,52 +975,52 @@ static HRESULT get_system_propval( const struct view *view, UINT index, const WC if (type) *type = CIM_SINT32; return S_OK; } - else if (!strcmpiW( name, namespaceW )) + else if (!wcsicmp( name, namespaceW )) { if (ret) { V_VT( ret ) = VT_BSTR; - V_BSTR( ret ) = build_namespace( view ); + V_BSTR( ret ) = view->proplist ? NULL : build_namespace(); } if (type) *type = CIM_STRING; return S_OK; } - else if (!strcmpiW( name, pathW )) + else if (!wcsicmp( name, pathW )) { if (ret) { V_VT( ret ) = VT_BSTR; - V_BSTR( ret ) = build_path( view, index, name ); + V_BSTR( ret ) = build_path( view, table_index, result_index, name ); } if (type) *type = CIM_STRING; return S_OK; } - if (!strcmpiW( name, propcountW )) + if (!wcsicmp( name, propcountW )) { if (ret) { V_VT( ret ) = VT_I4; - V_I4( ret ) = count_selected_properties( view ); + V_I4( ret ) = count_result_properties( view, table_index ); } if (type) *type = CIM_SINT32; return S_OK; } - else if (!strcmpiW( name, relpathW )) + else if (!wcsicmp( name, relpathW )) { if (ret) { V_VT( ret ) = VT_BSTR; - V_BSTR( ret ) = build_relpath( view, index, name ); + V_BSTR( ret ) = build_relpath( view, table_index, result_index, name ); } if (type) *type = CIM_STRING; return S_OK; } - else if (!strcmpiW( name, serverW )) + else if (!wcsicmp( name, serverW )) { if (ret) { V_VT( ret ) = VT_BSTR; - V_BSTR( ret ) = build_servername( view ); + V_BSTR( ret ) = view->proplist ? NULL : build_servername(); } if (type) *type = CIM_STRING; return S_OK; @@ -744,17 +1033,25 @@ VARTYPE to_vartype( CIMTYPE type ) { switch (type) { - case CIM_BOOLEAN: return VT_BOOL; + case CIM_BOOLEAN: return VT_BOOL; + case CIM_STRING: - case CIM_DATETIME: return VT_BSTR; - case CIM_SINT8: return VT_I1; - case CIM_UINT8: return VT_UI1; - case CIM_SINT16: return VT_I2; - case CIM_UINT16: return VT_UI2; - case CIM_SINT32: return VT_I4; - case CIM_UINT32: return VT_UI4; - case CIM_SINT64: return VT_I8; - case CIM_UINT64: return VT_UI8; + case CIM_REFERENCE: + case CIM_DATETIME: return VT_BSTR; + + case CIM_SINT8: return VT_I1; + case CIM_UINT8: return VT_UI1; + case CIM_SINT16: return VT_I2; + + case CIM_UINT16: + case CIM_SINT32: + case CIM_UINT32: return VT_I4; + + case CIM_SINT64: return VT_I8; + case CIM_UINT64: return VT_UI8; + + case CIM_REAL32: return VT_R4; + default: ERR("unhandled type %u\n", type); break; @@ -762,18 +1059,17 @@ VARTYPE to_vartype( CIMTYPE type ) return 0; } -SAFEARRAY *to_safearray( const struct array *array, CIMTYPE type ) +SAFEARRAY *to_safearray( const struct array *array, CIMTYPE basetype ) { SAFEARRAY *ret; - UINT size = get_type_size( type ); - VARTYPE vartype = to_vartype( type ); + VARTYPE vartype = to_vartype( basetype ); LONG i; if (!array || !(ret = SafeArrayCreateVector( vartype, 0, array->count ))) return NULL; for (i = 0; i < array->count; i++) { - void *ptr = (char *)array->ptr + i * size; + void *ptr = (char *)array->ptr + i * array->elem_size; if (vartype == VT_BSTR) { BSTR str = SysAllocString( *(const WCHAR **)ptr ); @@ -830,6 +1126,9 @@ void set_variant( VARTYPE type, LONGLONG val, void *val_ptr, VARIANT *ret ) break; case VT_NULL: break; + case VT_R4: + V_R4( ret ) = *(FLOAT *)&val; + break; default: ERR("unhandled variant type %u\n", type); return; @@ -837,48 +1136,88 @@ void set_variant( VARTYPE type, LONGLONG val, void *val_ptr, VARIANT *ret ) V_VT( ret ) = type; } -HRESULT get_propval( const struct view *view, UINT index, const WCHAR *name, VARIANT *ret, - CIMTYPE *type, LONG *flavor ) +static HRESULT map_view_index( const struct view *view, UINT index, UINT *table_index, UINT *result_index ) +{ + if (!view->table) return WBEM_E_NOT_FOUND; + + switch (view->type) + { + case VIEW_TYPE_SELECT: + *table_index = 0; + *result_index = index; + break; + + case VIEW_TYPE_ASSOCIATORS: + *table_index = *result_index = index; + break; + + default: + ERR( "unhandled view type %u\n", view->type ); + return WBEM_E_FAILED; + } + return S_OK; +} + +struct table *get_view_table( const struct view *view, UINT index ) +{ + switch (view->type) + { + case VIEW_TYPE_SELECT: + return view->table[0]; + + case VIEW_TYPE_ASSOCIATORS: + return view->table[index]; + + default: + ERR( "unhandled view type %u\n", view->type ); + return NULL; + } +} + +HRESULT get_propval( const struct view *view, UINT index, const WCHAR *name, VARIANT *ret, CIMTYPE *type, + LONG *flavor ) { HRESULT hr; - UINT column, row; + UINT column, row, table_index, result_index; + struct table *table; VARTYPE vartype; void *val_ptr = NULL; LONGLONG val; - if (is_system_prop( name )) return get_system_propval( view, index, name, ret, type, flavor ); - if (!view->count || !is_selected_prop( view, name )) return WBEM_E_NOT_FOUND; + if ((hr = map_view_index( view, index, &table_index, &result_index )) != S_OK) return hr; - hr = get_column_index( view->table, name, &column ); - if (hr != S_OK || is_method( view->table, column )) return WBEM_E_NOT_FOUND; + if (is_system_prop( name )) return get_system_propval( view, table_index, result_index, name, ret, type, flavor ); + if (!view->result_count || !is_result_prop( view, name )) return WBEM_E_NOT_FOUND; - row = view->result[index]; - hr = get_value( view->table, row, column, &val ); + table = view->table[table_index]; + hr = get_column_index( table, name, &column ); + if (hr != S_OK || is_method( table, column )) return WBEM_E_NOT_FOUND; + + row = view->result[result_index]; + hr = get_value( table, row, column, &val ); if (hr != S_OK) return hr; - if (type) *type = view->table->columns[column].type & COL_TYPE_MASK; + if (type) *type = table->columns[column].type & COL_TYPE_MASK; if (flavor) *flavor = 0; if (!ret) return S_OK; - vartype = view->table->columns[column].vartype; - if (view->table->columns[column].type & CIM_FLAG_ARRAY) + vartype = to_vartype( table->columns[column].type & CIM_TYPE_MASK ); + if (table->columns[column].type & CIM_FLAG_ARRAY) { - CIMTYPE basetype = view->table->columns[column].type & CIM_TYPE_MASK; + CIMTYPE basetype = table->columns[column].type & CIM_TYPE_MASK; val_ptr = to_safearray( (const struct array *)(INT_PTR)val, basetype ); if (!val_ptr) vartype = VT_NULL; - else if (!vartype) vartype = to_vartype( basetype ) | VT_ARRAY; + else vartype |= VT_ARRAY; set_variant( vartype, val, val_ptr, ret ); return S_OK; } - switch (view->table->columns[column].type & COL_TYPE_MASK) + switch (table->columns[column].type & COL_TYPE_MASK) { - case CIM_BOOLEAN: - if (!vartype) vartype = VT_BOOL; - break; case CIM_STRING: + case CIM_REFERENCE: case CIM_DATETIME: if (val) { @@ -888,34 +1227,25 @@ HRESULT get_propval( const struct view *view, UINT index, const WCHAR *name, VAR else vartype = VT_NULL; break; - case CIM_SINT8: - if (!vartype) vartype = VT_I1; + case CIM_SINT64: + vartype = VT_BSTR; + val_ptr = get_value_bstr( table, row, column ); break; - case CIM_UINT8: - if (!vartype) vartype = VT_UI1; + case CIM_UINT64: + vartype = VT_BSTR; + val_ptr = get_value_bstr( table, row, column ); break; + case CIM_BOOLEAN: + case CIM_SINT8: + case CIM_UINT8: case CIM_SINT16: - if (!vartype) vartype = VT_I2; - break; case CIM_UINT16: - if (!vartype) vartype = VT_UI2; - break; case CIM_SINT32: - if (!vartype) vartype = VT_I4; - break; case CIM_UINT32: - if (!vartype) vartype = VT_UI4; - break; - case CIM_SINT64: - vartype = VT_BSTR; - val_ptr = get_value_bstr( view->table, row, column ); - break; - case CIM_UINT64: - vartype = VT_BSTR; - val_ptr = get_value_bstr( view->table, row, column ); + case CIM_REAL32: break; default: - ERR("unhandled column type %u\n", view->table->columns[column].type); + ERR("unhandled column type %u\n", table->columns[column].type); return WBEM_E_FAILED; } @@ -950,23 +1280,22 @@ static struct array *to_array( VARIANT *var, CIMTYPE *type ) LONG bound, i; VARTYPE vartype; CIMTYPE basetype; - UINT size; if (SafeArrayGetVartype( V_ARRAY( var ), &vartype ) != S_OK) return NULL; if (!(basetype = to_cimtype( vartype ))) return NULL; if (SafeArrayGetUBound( V_ARRAY( var ), 1, &bound ) != S_OK) return NULL; if (!(ret = heap_alloc( sizeof(struct array) ))) return NULL; - ret->count = bound + 1; - size = get_type_size( basetype ); - if (!(ret->ptr = heap_alloc_zero( ret->count * size ))) + ret->count = bound + 1; + ret->elem_size = get_type_size( basetype ); + if (!(ret->ptr = heap_alloc_zero( ret->count * ret->elem_size ))) { heap_free( ret ); return NULL; } for (i = 0; i < ret->count; i++) { - void *ptr = (char *)ret->ptr + i * size; + void *ptr = (char *)ret->ptr + i * ret->elem_size; if (vartype == VT_BSTR) { BSTR str; @@ -1046,45 +1375,56 @@ HRESULT to_longlong( VARIANT *var, LONGLONG *val, CIMTYPE *type ) HRESULT put_propval( const struct view *view, UINT index, const WCHAR *name, VARIANT *var, CIMTYPE type ) { HRESULT hr; - UINT column, row = view->result[index]; + UINT row, column, table_index, result_index; + struct table *table; LONGLONG val; - hr = get_column_index( view->table, name, &column ); + if ((hr = map_view_index( view, index, &table_index, &result_index )) != S_OK) return hr; + + table = view->table[table_index]; + hr = get_column_index( table, name, &column ); if (hr != S_OK) { FIXME("no support for creating new properties\n"); return WBEM_E_FAILED; } - if (is_method( view->table, column ) || !(view->table->columns[column].type & COL_FLAG_DYNAMIC)) + if (is_method( table, column ) || !(table->columns[column].type & COL_FLAG_DYNAMIC)) return WBEM_E_FAILED; hr = to_longlong( var, &val, &type ); if (hr != S_OK) return hr; - return set_value( view->table, row, column, val, type ); + row = view->result[result_index]; + return set_value( table, row, column, val, type ); } -HRESULT get_properties( const struct view *view, LONG flags, SAFEARRAY **props ) +HRESULT get_properties( const struct view *view, UINT index, LONG flags, SAFEARRAY **props ) { SAFEARRAY *sa; BSTR str; - UINT i, num_props = count_selected_properties( view ); + UINT i, table_index, result_index, num_props; + struct table *table; + HRESULT hr; LONG j; + if ((hr = map_view_index( view, index, &table_index, &result_index )) != S_OK) return hr; + + num_props = count_result_properties( view, table_index ); if (!(sa = SafeArrayCreateVector( VT_BSTR, 0, num_props ))) return E_OUTOFMEMORY; - for (i = 0, j = 0; i < view->table->num_cols; i++) + table = view->table[table_index]; + for (i = 0, j = 0; i < table->num_cols; i++) { BOOL is_system; - if (is_method( view->table, i )) continue; - if (!is_selected_prop( view, view->table->columns[i].name )) continue; + if (is_method( table, i )) continue; + if (!is_result_prop( view, table->columns[i].name )) continue; - is_system = is_system_prop( view->table->columns[i].name ); + is_system = is_system_prop( table->columns[i].name ); if ((flags & WBEM_FLAG_NONSYSTEM_ONLY) && is_system) continue; else if ((flags & WBEM_FLAG_SYSTEM_ONLY) && !is_system) continue; - str = SysAllocString( view->table->columns[i].name ); + str = SysAllocString( table->columns[i].name ); if (!str || SafeArrayPutElement( sa, &j, str ) != S_OK) { SysFreeString( str ); diff --git a/dll/win32/wbemprox/reg.c b/dll/win32/wbemprox/reg.c index c45cbbef78c..1cbad2df81f 100644 --- a/dll/win32/wbemprox/reg.c +++ b/dll/win32/wbemprox/reg.c @@ -20,7 +20,6 @@ #define COBJMACROS -#include "config.h" #include <stdarg.h> #include "windef.h" diff --git a/dll/win32/wbemprox/security.c b/dll/win32/wbemprox/security.c index d3057e01f55..3ad7321a60c 100644 --- a/dll/win32/wbemprox/security.c +++ b/dll/win32/wbemprox/security.c @@ -20,7 +20,6 @@ #define COBJMACROS -#include "config.h" #include <stdarg.h> #include "windef.h" diff --git a/dll/win32/wbemprox/service.c b/dll/win32/wbemprox/service.c index b096c5ceb90..53010bc100c 100644 --- a/dll/win32/wbemprox/service.c +++ b/dll/win32/wbemprox/service.c @@ -20,7 +20,6 @@ #define COBJMACROS -#include "config.h" #include <stdarg.h> #include "windef.h" diff --git a/dll/win32/wbemprox/services.c b/dll/win32/wbemprox/services.c index 599a421ced8..b0840fbd3d3 100644 --- a/dll/win32/wbemprox/services.c +++ b/dll/win32/wbemprox/services.c @@ -18,8 +18,10 @@ #define COBJMACROS -#include "config.h" #include <stdarg.h> +#ifdef __REACTOS__ +#include <wchar.h> +#endif #include "windef.h" #include "winbase.h" @@ -27,7 +29,6 @@ #include "wbemcli.h" #include "wine/debug.h" -#include "wine/unicode.h" #include "wbemprox_private.h" WINE_DEFAULT_DEBUG_CHANNEL(wbemprox); @@ -279,7 +280,7 @@ static HRESULT WINAPI wbem_services_OpenNamespace( TRACE("%p, %s, 0x%08x, %p, %p, %p\n", iface, debugstr_w(strNamespace), lFlags, pCtx, ppWorkingNamespace, ppResult); - if ((strcmpiW( strNamespace, cimv2W ) && strcmpiW( strNamespace, defaultW )) || ws->namespace) + if ((wcsicmp( strNamespace, cimv2W ) && wcsicmp( strNamespace, defaultW )) || ws->namespace) return WBEM_E_INVALID_NAMESPACE; return WbemServices_create( cimv2W, (void **)ppWorkingNamespace ); @@ -322,15 +323,7 @@ static HRESULT WINAPI wbem_services_QueryObjectSink( return WBEM_E_FAILED; } -struct path -{ - WCHAR *class; - UINT class_len; - WCHAR *filter; - UINT filter_len; -}; - -static HRESULT parse_path( const WCHAR *str, struct path **ret ) +HRESULT parse_path( const WCHAR *str, struct path **ret ) { struct path *path; const WCHAR *p = str, *q; @@ -340,31 +333,47 @@ static HRESULT parse_path( const WCHAR *str, struct path **ret ) if (*p == '\\') { - static const WCHAR cimv2W[] = {'R','O','O','T','\\','C','I','M','V','2'}; - + static const WCHAR cimv2W[] = {'R','O','O','T','\\','C','I','M','V','2',0}; WCHAR server[MAX_COMPUTERNAME_LENGTH+1]; DWORD server_len = ARRAY_SIZE(server); p++; - if (*p != '\\') return WBEM_E_INVALID_OBJECT_PATH; + if (*p != '\\') + { + heap_free( path ); + return WBEM_E_INVALID_OBJECT_PATH; + } p++; q = p; while (*p && *p != '\\') p++; - if (!*p) return WBEM_E_INVALID_OBJECT_PATH; + if (!*p) + { + heap_free( path ); + return WBEM_E_INVALID_OBJECT_PATH; + } len = p - q; - if (!GetComputerNameW( server, &server_len ) || server_len != len - || memcmp( q, server, server_len * sizeof(WCHAR) )) + if (!GetComputerNameW( server, &server_len ) || server_len != len || _wcsnicmp( q, server, server_len )) + { + heap_free( path ); return WBEM_E_NOT_SUPPORTED; + } q = ++p; while (*p && *p != ':') p++; - if (!*p) return WBEM_E_INVALID_OBJECT_PATH; + if (!*p) + { + heap_free( path ); + return WBEM_E_INVALID_OBJECT_PATH; + } len = p - q; - if (len != ARRAY_SIZE(cimv2W) || memcmp( q, cimv2W, sizeof(cimv2W) )) + if (len != ARRAY_SIZE(cimv2W) - 1 || _wcsnicmp( q, cimv2W, ARRAY_SIZE(cimv2W) - 1 )) + { + heap_free( path ); return WBEM_E_INVALID_NAMESPACE; + } p++; } @@ -401,14 +410,15 @@ static HRESULT parse_path( const WCHAR *str, struct path **ret ) return S_OK; } -static void free_path( struct path *path ) +void free_path( struct path *path ) { + if (!path) return; heap_free( path->class ); heap_free( path->filter ); heap_free( path ); } -static WCHAR *query_from_path( const struct path *path ) +WCHAR *query_from_path( const struct path *path ) { static const WCHAR selectW[] = {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','%','s',' ', @@ -422,14 +432,14 @@ static WCHAR *query_from_path( const struct path *path ) { len = path->class_len + path->filter_len + ARRAY_SIZE(selectW); if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return NULL; - sprintfW( query, selectW, path->class, path->filter ); + swprintf( query, selectW, path->class, path->filter ); } else { len = path->class_len + ARRAY_SIZE(select_allW); if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return NULL; - strcpyW( query, select_allW ); - strcatW( query, path->class ); + lstrcpyW( query, select_allW ); + lstrcatW( query, path->class ); } return query; } @@ -653,7 +663,7 @@ static HRESULT WINAPI wbem_services_ExecQuery( debugstr_w(strQuery), lFlags, pCtx, ppEnum); if (!strQueryLanguage || !strQuery || !strQuery[0]) return WBEM_E_INVALID_PARAMETER; - if (strcmpiW( strQueryLanguage, wqlW )) return WBEM_E_INVALID_QUERY_TYPE; + if (wcsicmp( strQueryLanguage, wqlW )) return WBEM_E_INVALID_QUERY_TYPE; return exec_query( strQuery, ppEnum ); } @@ -823,6 +833,7 @@ static HRESULT WINAPI wbem_services_ExecMethod( struct path *path; WCHAR *str; class_method *func; + struct table *table; HRESULT hr; TRACE("%p, %s, %s, %08x, %p, %p, %p, %p\n", iface, debugstr_w(strObjectPath), @@ -850,10 +861,11 @@ static HRESULT WINAPI wbem_services_ExecMethod( hr = EnumWbemClassObject_create( query, (void **)&result ); if (hr != S_OK) goto done; - hr = create_class_object( query->view->table->name, result, 0, NULL, &obj ); + table = get_view_table( query->view, 0 ); + hr = create_class_object( table->name, result, 0, NULL, &obj ); if (hr != S_OK) goto done; - hr = get_method( query->view->table, strMethodName, &func ); + hr = get_method( table, strMethodName, &func ); if (hr != S_OK) goto done; hr = func( obj, pInParams, ppOutParams ); diff --git a/dll/win32/wbemprox/table.c b/dll/win32/wbemprox/table.c index ad56e0c7bab..8e08d952257 100644 --- a/dll/win32/wbemprox/table.c +++ b/dll/win32/wbemprox/table.c @@ -18,8 +18,10 @@ #define COBJMACROS -#include "config.h" #include <stdarg.h> +#ifdef __REACTOS__ +#include <wchar.h> +#endif #include "windef.h" #include "winbase.h" @@ -35,7 +37,7 @@ HRESULT get_column_index( const struct table *table, const WCHAR *name, UINT *co UINT i; for (i = 0; i < table->num_cols; i++) { - if (!strcmpiW( table->columns[i].name, name )) + if (!wcsicmp( table->columns[i].name, name )) { *column = i; return S_OK; @@ -65,8 +67,11 @@ UINT get_type_size( CIMTYPE type ) case CIM_UINT64: return sizeof(INT64); case CIM_DATETIME: + case CIM_REFERENCE: case CIM_STRING: return sizeof(WCHAR *); + case CIM_REAL32: + return sizeof(FLOAT); default: ERR("unhandled type %u\n", type); break; @@ -111,6 +116,7 @@ HRESULT get_value( const struct table *table, UINT row, UINT column, LONGLONG *v *val = *(const int *)ptr; break; case CIM_DATETIME: + case CIM_REFERENCE: case CIM_STRING: *val = (INT_PTR)*(const WCHAR **)ptr; break; @@ -138,6 +144,9 @@ HRESULT get_value( const struct table *table, UINT row, UINT column, LONGLONG *v case CIM_UINT64: *val = *(const UINT64 *)ptr; break; + case CIM_REAL32: + memcpy( val, ptr, sizeof(FLOAT) ); + break; default: ERR("invalid column type %u\n", table->columns[column].type & COL_TYPE_MASK); *val = 0; @@ -174,21 +183,22 @@ BSTR get_value_bstr( const struct table *table, UINT row, UINT column ) else return SysAllocString( falseW ); case CIM_DATETIME: + case CIM_REFERENCE: case CIM_STRING: if (!val) return NULL; - len = strlenW( (const WCHAR *)(INT_PTR)val ) + 2; + len = lstrlenW( (const WCHAR *)(INT_PTR)val ) + 2; if (!(ret = SysAllocStringLen( NULL, len ))) return NULL; - sprintfW( ret, fmt_strW, (const WCHAR *)(INT_PTR)val ); + swprintf( ret, fmt_strW, (const WCHAR *)(INT_PTR)val ); return ret; case CIM_SINT16: case CIM_SINT32: - sprintfW( number, fmt_signedW, val ); + swprintf( number, fmt_signedW, val ); return SysAllocString( number ); case CIM_UINT16: case CIM_UINT32: - sprintfW( number, fmt_unsignedW, val ); + swprintf( number, fmt_unsignedW, val ); return SysAllocString( number ); case CIM_SINT64: @@ -221,6 +231,7 @@ HRESULT set_value( const struct table *table, UINT row, UINT column, LONGLONG va switch (table->columns[column].type & COL_TYPE_MASK) { case CIM_DATETIME: + case CIM_REFERENCE: case CIM_STRING: *(WCHAR **)ptr = (WCHAR *)(INT_PTR)val; break; @@ -263,7 +274,7 @@ HRESULT get_method( const struct table *table, const WCHAR *name, class_method * { for (j = 0; j < table->num_cols; j++) { - if (table->columns[j].type & COL_FLAG_METHOD && !strcmpW( table->columns[j].name, name )) + if (table->columns[j].type & COL_FLAG_METHOD && !wcscmp( table->columns[j].name, name )) { HRESULT hr; LONGLONG val; @@ -288,7 +299,7 @@ void free_row_values( const struct table *table, UINT row ) if (!(table->columns[i].type & COL_FLAG_DYNAMIC)) continue; type = table->columns[i].type & COL_TYPE_MASK; - if (type == CIM_STRING || type == CIM_DATETIME) + if (type == CIM_STRING || type == CIM_DATETIME || type == CIM_REFERENCE) { if (get_value( table, row, i, &val ) == S_OK) heap_free( (void *)(INT_PTR)val ); } @@ -357,7 +368,7 @@ struct table *grab_table( const WCHAR *name ) LIST_FOR_EACH_ENTRY( table, table_list, struct table, entry ) { - if (!strcmpiW( table->name, name )) + if (name && !wcsicmp( table->name, name )) { TRACE("returning %p\n", table); return addref_table( table ); @@ -392,7 +403,7 @@ BOOL add_table( struct table *table ) LIST_FOR_EACH_ENTRY( iter, table_list, struct table, entry ) { - if (!strcmpiW( iter->name, table->name )) + if (!wcsicmp( iter->name, table->name )) { TRACE("table %s already exists\n", debugstr_w(table->name)); return FALSE; diff --git a/dll/win32/wbemprox/wbemlocator.c b/dll/win32/wbemprox/wbemlocator.c index fe26a871b50..7bd49c80e83 100644 --- a/dll/win32/wbemprox/wbemlocator.c +++ b/dll/win32/wbemprox/wbemlocator.c @@ -18,7 +18,6 @@ #define COBJMACROS -#include "config.h" #include <stdarg.h> #include "windef.h" @@ -27,7 +26,6 @@ #include "wbemcli.h" #include "wine/debug.h" -#include "wine/unicode.h" #include "wbemprox_private.h" WINE_DEFAULT_DEBUG_CHANNEL(wbemprox); @@ -93,16 +91,16 @@ static BOOL is_local_machine( const WCHAR *server ) WCHAR buffer[MAX_COMPUTERNAME_LENGTH + 1]; DWORD len = ARRAY_SIZE( buffer ); - if (!server || !strcmpW( server, dotW ) || !strcmpiW( server, localhostW )) return TRUE; - if (GetComputerNameW( buffer, &len ) && !strcmpiW( server, buffer )) return TRUE; + if (!server || !wcscmp( server, dotW ) || !wcsicmp( server, localhostW )) return TRUE; + if (GetComputerNameW( buffer, &len ) && !wcsicmp( server, buffer )) return TRUE; return FALSE; } static HRESULT parse_resource( const WCHAR *resource, WCHAR **server, WCHAR **namespace ) { static const WCHAR rootW[] = {'R','O','O','T'}; - static const WCHAR cimv2W[] = {'C','I','M','V','2'}; - static const WCHAR defaultW[] = {'D','E','F','A','U','L','T'}; + static const WCHAR cimv2W[] = {'C','I','M','V','2',0}; + static const WCHAR defaultW[] = {'D','E','F','A','U','L','T',0}; HRESULT hr = WBEM_E_INVALID_NAMESPACE; const WCHAR *p, *q; unsigned int len; @@ -133,16 +131,15 @@ static HRESULT parse_resource( const WCHAR *resource, WCHAR **server, WCHAR **na p = q; while (*q && *q != '\\' && *q != '/') q++; len = q - p; - if (len >= ARRAY_SIZE( rootW ) && memicmpW( rootW, p, len )) goto done; + if (len >= ARRAY_SIZE( rootW ) && _wcsnicmp( rootW, p, len )) goto done; if (!*q) { hr = S_OK; goto done; } q++; - len = strlenW( q ); - if ((len != ARRAY_SIZE( cimv2W ) || memicmpW( q, cimv2W, len )) && - (len != ARRAY_SIZE( defaultW ) || memicmpW( q, defaultW, len ))) + len = lstrlenW( q ); + if (wcsicmp( q, cimv2W ) && wcsicmp( q, defaultW )) goto done; if (!(*namespace = heap_alloc( (len + 1) * sizeof(WCHAR) ))) hr = E_OUTOFMEMORY; else diff --git a/dll/win32/wbemprox/wbemprox_private.h b/dll/win32/wbemprox/wbemprox_private.h index 596ad21d51b..5c04c45d973 100644 --- a/dll/win32/wbemprox/wbemprox_private.h +++ b/dll/win32/wbemprox/wbemprox_private.h @@ -21,7 +21,9 @@ #include "wine/debug.h" #include "wine/heap.h" #include "wine/list.h" -#include "wine/unicode.h" +#ifdef __REACTOS__ +#include <winnls.h> +#endif IClientSecurity client_security DECLSPEC_HIDDEN; struct list *table_list DECLSPEC_HIDDEN; @@ -92,7 +94,6 @@ struct column { const WCHAR *name; UINT type; - VARTYPE vartype; /* 0 for default mapping */ }; enum fill_status @@ -127,6 +128,7 @@ struct property struct array { + UINT elem_size; UINT count; void *ptr; }; @@ -134,7 +136,6 @@ struct array struct field { UINT type; - VARTYPE vartype; /* 0 for default mapping */ union { LONGLONG ival; @@ -150,13 +151,30 @@ struct record struct table *table; }; +struct keyword +{ + const WCHAR *name; + const WCHAR *value; + const struct keyword *next; +}; + +enum view_type +{ + VIEW_TYPE_SELECT, + VIEW_TYPE_ASSOCIATORS, +}; + struct view { - const struct property *proplist; - struct table *table; + enum view_type type; + const WCHAR *path; /* ASSOCIATORS OF query */ + const struct keyword *keywordlist; + const struct property *proplist; /* SELECT query */ const struct expr *cond; + UINT table_count; + struct table **table; + UINT result_count; UINT *result; - UINT count; }; struct query @@ -166,16 +184,29 @@ struct query struct list mem; }; +struct path +{ + WCHAR *class; + UINT class_len; + WCHAR *filter; + UINT filter_len; +}; + +HRESULT parse_path( const WCHAR *, struct path ** ) DECLSPEC_HIDDEN; +void free_path( struct path * ) DECLSPEC_HIDDEN; +WCHAR *query_from_path( const struct path * ) DECLSPEC_HIDDEN; + struct query *create_query(void) DECLSPEC_HIDDEN; void free_query( struct query * ) DECLSPEC_HIDDEN; struct query *addref_query( struct query * ) DECLSPEC_HIDDEN; void release_query( struct query *query ) DECLSPEC_HIDDEN; HRESULT exec_query( const WCHAR *, IEnumWbemClassObject ** ) DECLSPEC_HIDDEN; HRESULT parse_query( const WCHAR *, struct view **, struct list * ) DECLSPEC_HIDDEN; -HRESULT create_view( const struct property *, const WCHAR *, const struct expr *, - struct view ** ) DECLSPEC_HIDDEN; +HRESULT create_view( enum view_type, const WCHAR *, const struct keyword *, const WCHAR *, const struct property *, + const struct expr *, struct view ** ) DECLSPEC_HIDDEN; void destroy_view( struct view * ) DECLSPEC_HIDDEN; HRESULT execute_view( struct view * ) DECLSPEC_HIDDEN; +struct table *get_view_table( const struct view *, UINT ) DECLSPEC_HIDDEN; void init_table_list( void ) DECLSPEC_HIDDEN; struct table *grab_table( const WCHAR * ) DECLSPEC_HIDDEN; struct table *addref_table( struct table * ) DECLSPEC_HIDDEN; @@ -195,15 +226,14 @@ BSTR get_value_bstr( const struct table *, UINT, UINT ) DECLSPEC_HIDDEN; HRESULT set_value( const struct table *, UINT, UINT, LONGLONG, CIMTYPE ) DECLSPEC_HIDDEN; BOOL is_method( const struct table *, UINT ) DECLSPEC_HIDDEN; HRESULT get_method( const struct table *, const WCHAR *, class_method ** ) DECLSPEC_HIDDEN; -HRESULT get_propval( const struct view *, UINT, const WCHAR *, VARIANT *, - CIMTYPE *, LONG * ) DECLSPEC_HIDDEN; +HRESULT get_propval( const struct view *, UINT, const WCHAR *, VARIANT *, CIMTYPE *, LONG * ) DECLSPEC_HIDDEN; HRESULT put_propval( const struct view *, UINT, const WCHAR *, VARIANT *, CIMTYPE ) DECLSPEC_HIDDEN; HRESULT to_longlong( VARIANT *, LONGLONG *, CIMTYPE * ) DECLSPEC_HIDDEN; SAFEARRAY *to_safearray( const struct array *, CIMTYPE ) DECLSPEC_HIDDEN; VARTYPE to_vartype( CIMTYPE ) DECLSPEC_HIDDEN; void destroy_array( struct array *, CIMTYPE ) DECLSPEC_HIDDEN; -BOOL is_selected_prop( const struct view *, const WCHAR * ) DECLSPEC_HIDDEN; -HRESULT get_properties( const struct view *, LONG, SAFEARRAY ** ) DECLSPEC_HIDDEN; +BOOL is_result_prop( const struct view *, const WCHAR * ) DECLSPEC_HIDDEN; +HRESULT get_properties( const struct view *, UINT, LONG, SAFEARRAY ** ) DECLSPEC_HIDDEN; HRESULT get_object( const WCHAR *, IWbemClassObject ** ) DECLSPEC_HIDDEN; BSTR get_method_name( const WCHAR *, UINT ) DECLSPEC_HIDDEN; void set_variant( VARTYPE, LONGLONG, void *, VARIANT * ) DECLSPEC_HIDDEN; @@ -233,7 +263,17 @@ static inline WCHAR *heap_strdupW( const WCHAR *src ) { WCHAR *dst; if (!src) return NULL; - if ((dst = heap_alloc( (strlenW( src ) + 1) * sizeof(WCHAR) ))) strcpyW( dst, src ); + if ((dst = heap_alloc( (lstrlenW( src ) + 1) * sizeof(WCHAR) ))) lstrcpyW( dst, src ); + return dst; +} + +static inline WCHAR *heap_strdupAW( const char *src ) +{ + int len; + WCHAR *dst; + if (!src) return NULL; + len = MultiByteToWideChar( CP_ACP, 0, src, -1, NULL, 0 ); + if ((dst = heap_alloc( len * sizeof(*dst) ))) MultiByteToWideChar( CP_ACP, 0, src, -1, dst, len ); return dst; } diff --git a/dll/win32/wbemprox/wql.tab.c b/dll/win32/wbemprox/wql.tab.c index 42e82328546..62249558393 100644 --- a/dll/win32/wbemprox/wql.tab.c +++ b/dll/win32/wbemprox/wql.tab.c @@ -1,8 +1,9 @@ -/* A Bison parser, made by GNU Bison 3.0. */ +/* A Bison parser, made by GNU Bison 3.4.1. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,11 +41,14 @@ define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ +/* Undocumented macros, especially those whose name start with YY_, + are private implementation details. Do not rely on them. */ + /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.0" +#define YYBISON_VERSION "3.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -67,8 +71,8 @@ #define yynerrs wql_nerrs -/* Copy the first part of user declarations. */ -#line 1 "wql.y" /* yacc.c:339 */ +/* First part of user prologue. */ +#line 1 "wql.y" /* @@ -89,7 +93,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" #include <stdarg.h> #include "windef.h" @@ -99,7 +102,6 @@ #include "wine/list.h" #include "wine/debug.h" -#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(wbemprox); @@ -138,6 +140,18 @@ static struct property *alloc_property( struct parser *parser, const WCHAR *clas return prop; } +static struct keyword *alloc_keyword( struct parser *parser, const WCHAR *name, const WCHAR *value ) +{ ... 2009 lines suppressed ...
1
0
0
0
[reactos] 01/01: [PSDK] Add GetSystemFirmwareTable. CORE-16441
by Amine Khaldi
01 Dec '19
01 Dec '19
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e5a5f62909b78979eb2e6…
commit e5a5f62909b78979eb2e6fb9b62c91dde9af2a43 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sun Dec 1 19:44:36 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Dec 1 19:44:36 2019 +0100 [PSDK] Add GetSystemFirmwareTable. CORE-16441 --- sdk/include/psdk/winbase.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sdk/include/psdk/winbase.h b/sdk/include/psdk/winbase.h index cd7446c5c4c..7c45b151c87 100644 --- a/sdk/include/psdk/winbase.h +++ b/sdk/include/psdk/winbase.h @@ -2369,6 +2369,16 @@ VOID WINAPI GetStartupInfoW(LPSTARTUPINFOW); HANDLE WINAPI GetStdHandle(_In_ DWORD); UINT WINAPI GetSystemDirectoryA(LPSTR,UINT); UINT WINAPI GetSystemDirectoryW(LPWSTR,UINT); + +WINBASEAPI +UINT +WINAPI +GetSystemFirmwareTable( + _In_ DWORD FirmwareTableProviderSignature, + _In_ DWORD FirmwareTableID, + _Out_writes_bytes_to_opt_(BufferSize,return) PVOID pFirmwareTableBuffer, + _In_ DWORD BufferSize); + VOID WINAPI GetSystemInfo(LPSYSTEM_INFO); BOOL WINAPI GetSystemPowerStatus(_Out_ LPSYSTEM_POWER_STATUS); #if (_WIN32_WINNT >= 0x0502)
1
0
0
0
[reactos] 01/01: [WBEMDISP] Sync with Wine Staging 4.18. CORE-16441
by Amine Khaldi
01 Dec '19
01 Dec '19
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=36873c49345171875fbbf…
commit 36873c49345171875fbbf50db6288003ebce6150 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sun Dec 1 19:44:13 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Dec 1 19:44:13 2019 +0100 [WBEMDISP] Sync with Wine Staging 4.18. CORE-16441 --- dll/win32/wbemdisp/locator.c | 28 +++++++++++++--------------- dll/win32/wbemdisp/main.c | 6 ++---- dll/win32/wbemdisp/precomp.h | 3 --- media/doc/README.WINE | 2 +- 4 files changed, 16 insertions(+), 23 deletions(-) diff --git a/dll/win32/wbemdisp/locator.c b/dll/win32/wbemdisp/locator.c index c307e347cf8..a9ef1618882 100644 --- a/dll/win32/wbemdisp/locator.c +++ b/dll/win32/wbemdisp/locator.c @@ -18,7 +18,6 @@ #define COBJMACROS -#include "config.h" #include <stdarg.h> #include "windef.h" @@ -31,7 +30,6 @@ #include "wine/debug.h" #include "wine/heap.h" -#include "wine/unicode.h" #include "wbemdisp_private.h" #include "wbemdisp_classes.h" @@ -620,8 +618,8 @@ static HRESULT init_members( struct object *object ) { count++; SysFreeString( name ); - IWbemClassObject_Release( sig_in ); - IWbemClassObject_Release( sig_out ); + if (sig_in) IWbemClassObject_Release( sig_in ); + if (sig_out) IWbemClassObject_Release( sig_out ); } IWbemClassObject_EndMethodEnumeration( object->object ); } @@ -659,8 +657,8 @@ static HRESULT init_members( struct object *object ) IWbemClassObject_EndMethodEnumeration( object->object ); goto error; } - IWbemClassObject_Release( sig_in ); - IWbemClassObject_Release( sig_out ); + if (sig_in) IWbemClassObject_Release( sig_in ); + if (sig_out) IWbemClassObject_Release( sig_out ); TRACE( "added method %s\n", debugstr_w(name) ); } IWbemClassObject_EndMethodEnumeration( object->object ); @@ -683,7 +681,7 @@ static DISPID get_member_dispid( struct object *object, const WCHAR *name ) UINT i; for (i = 0; i < object->nb_members; i++) { - if (!strcmpiW( object->members[i].name, name )) + if (!wcsicmp( object->members[i].name, name )) { if (!object->members[i].dispid) { @@ -1704,12 +1702,12 @@ static HRESULT WINAPI services_DeleteAsync( static BSTR build_query_string( const WCHAR *class ) { static const WCHAR selectW[] = {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',0}; - UINT len = strlenW(class) + ARRAY_SIZE(selectW); + UINT len = lstrlenW(class) + ARRAY_SIZE(selectW); BSTR ret; if (!(ret = SysAllocStringLen( NULL, len ))) return NULL; - strcpyW( ret, selectW ); - strcatW( ret, class ); + lstrcpyW( ret, selectW ); + lstrcatW( ret, class ); return ret; } @@ -2134,22 +2132,22 @@ static BSTR build_resource_string( BSTR server, BSTR namespace ) ULONG len, len_server = 0, len_namespace = 0; BSTR ret; - if (server && *server) len_server = strlenW( server ); + if (server && *server) len_server = lstrlenW( server ); else len_server = 1; - if (namespace && *namespace) len_namespace = strlenW( namespace ); + if (namespace && *namespace) len_namespace = lstrlenW( namespace ); else len_namespace = ARRAY_SIZE(defaultW) - 1; if (!(ret = SysAllocStringLen( NULL, 2 + len_server + 1 + len_namespace ))) return NULL; ret[0] = ret[1] = '\\'; - if (server && *server) strcpyW( ret + 2, server ); + if (server && *server) lstrcpyW( ret + 2, server ); else ret[2] = '.'; len = len_server + 2; ret[len++] = '\\'; - if (namespace && *namespace) strcpyW( ret + len, namespace ); - else strcpyW( ret + len, defaultW ); + if (namespace && *namespace) lstrcpyW( ret + len, namespace ); + else lstrcpyW( ret + len, defaultW ); return ret; } diff --git a/dll/win32/wbemdisp/main.c b/dll/win32/wbemdisp/main.c index aff4d5042b7..f434eecb353 100644 --- a/dll/win32/wbemdisp/main.c +++ b/dll/win32/wbemdisp/main.c @@ -16,7 +16,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" #include <stdarg.h> #define COBJMACROS @@ -30,7 +29,6 @@ #include "wine/debug.h" #include "wine/heap.h" -#include "wine/unicode.h" #include "wbemdisp_private.h" #include "wbemdisp_classes.h" @@ -384,7 +382,7 @@ static HRESULT WINAPI WinMGMTS_ParseDisplayName(IParseDisplayName *iface, IBindC TRACE( "%p, %p, %s, %p, %p\n", iface, pbc, debugstr_w(pszDisplayName), pchEaten, ppmkOut ); - if (strncmpiW( pszDisplayName, prefixW, prefix_len )) return MK_E_SYNTAX; + if (_wcsnicmp( pszDisplayName, prefixW, prefix_len )) return MK_E_SYNTAX; p = pszDisplayName + prefix_len; if (*p == '{') @@ -418,7 +416,7 @@ done: SysFreeString( server ); SysFreeString( namespace ); SysFreeString( relative ); - if (hr == S_OK) *pchEaten = strlenW( pszDisplayName ); + if (hr == S_OK) *pchEaten = lstrlenW( pszDisplayName ); return hr; } diff --git a/dll/win32/wbemdisp/precomp.h b/dll/win32/wbemdisp/precomp.h index c1f67ee56a5..0578883a8be 100644 --- a/dll/win32/wbemdisp/precomp.h +++ b/dll/win32/wbemdisp/precomp.h @@ -2,8 +2,6 @@ #ifndef _WBEMDISP_PRECOMP_H_ #define _WBEMDISP_PRECOMP_H_ -#include <wine/config.h> - #include <stdarg.h> #define WIN32_NO_STATUS @@ -19,7 +17,6 @@ #include <wbemdisp.h> #include <wine/debug.h> -#include <wine/unicode.h> #include "wbemdisp_private.h" diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 2d72bc86a44..3098a88e6d1 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -195,7 +195,7 @@ dll/win32/uxtheme # Forked dll/win32/vbscript # Synced to WineStaging-4.18 dll/win32/version # Synced to WineStaging-4.18 dll/win32/vssapi # Synced to WineStaging-4.18 -dll/win32/wbemdisp # Synced to WineStaging-4.0 +dll/win32/wbemdisp # Synced to WineStaging-4.18 dll/win32/wbemprox # Synced to WineStaging-4.0 dll/win32/windowscodecs # Synced to WineStaging-4.0 dll/win32/windowscodecsext # Synced to WineStaging-2.9
1
0
0
0
[reactos] 01/01: [VSSAPI] Sync with Wine Staging 4.18. CORE-16441
by Amine Khaldi
01 Dec '19
01 Dec '19
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=658118f09886feded96d3…
commit 658118f09886feded96d35d10e5f1e3b44f746db Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sun Dec 1 19:43:49 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Dec 1 19:43:49 2019 +0100 [VSSAPI] Sync with Wine Staging 4.18. CORE-16441 --- dll/win32/vssapi/main.c | 38 +++++++------------------------------- dll/win32/vssapi/vssapi.spec | 10 +++++----- media/doc/README.WINE | 2 +- 3 files changed, 13 insertions(+), 37 deletions(-) diff --git a/dll/win32/vssapi/main.c b/dll/win32/vssapi/main.c index 427447c2a15..acb24003397 100644 --- a/dll/win32/vssapi/main.c +++ b/dll/win32/vssapi/main.c @@ -16,48 +16,24 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#ifndef __REACTOS__ #include "config.h" +#endif #include <stdarg.h> #include "windef.h" #include "winbase.h" #include "vss.h" #include "vswriter.h" +#include "wine/asm.h" #include "wine/debug.h" -WINE_DEFAULT_DEBUG_CHANNEL( vssapi ); - -#ifdef __i386__ /* thiscall functions are i386-specific */ - -#define THISCALL(func) __thiscall_ ## func -#define THISCALL_NAME(func) __ASM_NAME("__thiscall_" #func) -#undef __thiscall -#define __thiscall __stdcall +#ifdef __REACTOS__ #ifdef _MSC_VER -#define DEFINE_THISCALL_WRAPPER(func,args) \ - void __declspec(naked) __thiscall_ ##func(void) \ - { \ - __asm { pop eax } \ - __asm { push ecx } \ - __asm { push eax } \ - __asm { jmp func } \ - } -#else -#define DEFINE_THISCALL_WRAPPER(func,args) \ - extern void THISCALL(func)(void); \ - __ASM_GLOBAL_FUNC(__thiscall_ ## func, \ - "popl %eax\n\t" \ - "pushl %ecx\n\t" \ - "pushl %eax\n\t" \ - "jmp " __ASM_NAME(#func) __ASM_STDCALL(args) ) +#define __thiscall __stdcall +#endif #endif -#else /* __i386__ */ - -#define THISCALL(func) func -#define THISCALL_NAME(func) __ASM_NAME(#func) -#define __thiscall __cdecl -#define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */ -#endif /* __i386__ */ +WINE_DEFAULT_DEBUG_CHANNEL( vssapi ); struct CVssWriter { diff --git a/dll/win32/vssapi/vssapi.spec b/dll/win32/vssapi/vssapi.spec index 84f9003ddc5..3c6ec60e356 100644 --- a/dll/win32/vssapi/vssapi.spec +++ b/dll/win32/vssapi/vssapi.spec @@ -2,9 +2,9 @@ @ stub VssFreeSnapshotProperties @ stub ShouldBlockRevert @ stub ??0CVssJetWriter@@QAE@XZ -@ cdecl -arch=i386 ??0CVssWriter@@QAE@XZ(ptr) __thiscall_VSSAPI_CVssWriter_default_ctor +@ cdecl -arch=i386 ??0CVssWriter@@QAE@XZ(ptr) VSSAPI_CVssWriter_default_ctor @ stub ??1CVssJetWriter@@UAE@XZ -@ cdecl -arch=i386 ??1CVssWriter@@UAE@XZ(ptr) __thiscall_VSSAPI_CVssWriter_dtor +@ cdecl -arch=i386 ??1CVssWriter@@UAE@XZ(ptr) VSSAPI_CVssWriter_dtor @ stub ?AreComponentsSelected@CVssJetWriter@@IBG_NXZ @ stub ?AreComponentsSelected@CVssWriter@@IBG_NXZ @ stub ?CreateVssBackupComponents@@YGJPAPAVIVssBackupComponents@@@Z @@ -27,7 +27,7 @@ @ stub ?GetSnapshotDeviceName@CVssJetWriter@@IBGJPBGPAPBG@Z @ stub ?GetSnapshotDeviceName@CVssWriter@@IBGJPBGPAPBG@Z @ stub ?Initialize@CVssJetWriter@@QAGJU_GUID@@PBG_N211K@Z -@ cdecl -arch=i386 ?Initialize@CVssWriter@@QAGJU_GUID@@PBGW4VSS_USAGE_TYPE@@W4VSS_SOURCE_TYPE@@W4_VSS_APPLICATION_LEVEL@@KW4VSS_ALTERNATE_WRITER_STATE@@_N@Z(ptr ptr wstr long long long long long long wstr) __thiscall_VSSAPI_CVssWriter_Initialize +@ cdecl -arch=i386 ?Initialize@CVssWriter@@QAGJU_GUID@@PBGW4VSS_USAGE_TYPE@@W4VSS_SOURCE_TYPE@@W4_VSS_APPLICATION_LEVEL@@KW4VSS_ALTERNATE_WRITER_STATE@@_N@Z(ptr ptr wstr long long long long long long wstr) VSSAPI_CVssWriter_Initialize @ stub ?InstallAlternateWriter@CVssWriter@@QAGJU_GUID@@0@Z @ stub ?IsBootableSystemStateBackedUp@CVssJetWriter@@IBG_NXZ @ stub ?IsBootableSystemStateBackedUp@CVssWriter@@IBG_NXZ @@ -67,9 +67,9 @@ @ stub ?OnVSSShutdown@CVssWriter@@UAG_NXZ @ stub ?SetWriterFailure@CVssJetWriter@@IAGJJ@Z @ stub ?SetWriterFailure@CVssWriter@@IAGJJ@Z -@ cdecl -arch=i386 ?Subscribe@CVssWriter@@QAGJK@Z(ptr long) __thiscall_VSSAPI_CVssWriter_Subscribe +@ cdecl -arch=i386 ?Subscribe@CVssWriter@@QAGJK@Z(ptr long) VSSAPI_CVssWriter_Subscribe @ stub ?Uninitialize@CVssJetWriter@@QAGXXZ -@ cdecl -arch=i386 ?Unsubscribe@CVssWriter@@QAGJXZ(ptr) __thiscall_VSSAPI_CVssWriter_Unsubscribe +@ cdecl -arch=i386 ?Unsubscribe@CVssWriter@@QAGJXZ(ptr) VSSAPI_CVssWriter_Unsubscribe @ stub CreateVssBackupComponentsInternal @ stub CreateVssExamineWriterMetadataInternal @ stub CreateVssExpressWriterInternal diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 050a8fe31c8..2d72bc86a44 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -194,7 +194,7 @@ dll/win32/usp10 # Synced to WineStaging-4.18 dll/win32/uxtheme # Forked dll/win32/vbscript # Synced to WineStaging-4.18 dll/win32/version # Synced to WineStaging-4.18 -dll/win32/vssapi # Synced to WineStaging-2.9 +dll/win32/vssapi # Synced to WineStaging-4.18 dll/win32/wbemdisp # Synced to WineStaging-4.0 dll/win32/wbemprox # Synced to WineStaging-4.0 dll/win32/windowscodecs # Synced to WineStaging-4.0
1
0
0
0
[reactos] 01/01: [VERSION] Sync with Wine Staging 4.18. CORE-16441
by Amine Khaldi
01 Dec '19
01 Dec '19
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f1e575c3d2b84f20db560…
commit f1e575c3d2b84f20db560bc3137df488891598bd Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sun Dec 1 19:43:24 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Dec 1 19:43:24 2019 +0100 [VERSION] Sync with Wine Staging 4.18. CORE-16441 --- dll/win32/version/version.c | 19 +++++++------------ media/doc/README.WINE | 2 +- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/dll/win32/version/version.c b/dll/win32/version/version.c index 68dd4a8df8c..0e2f35dd107 100644 --- a/dll/win32/version/version.c +++ b/dll/win32/version/version.c @@ -21,7 +21,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * */ -#include "config.h" #include <stdarg.h> #include <stdlib.h> @@ -29,9 +28,6 @@ #include <stdio.h> #include <sys/types.h> -#ifdef HAVE_UNISTD_H -# include <unistd.h> -#endif #define NONAMELESSUNION #define NONAMELESSSTRUCT @@ -40,9 +36,8 @@ #include "winver.h" #include "winuser.h" #include "winnls.h" -#include "winternl.h" +#include "wine/winternl.h" #include "lzexpand.h" -#include "wine/unicode.h" #include "winerror.h" #include "wine/debug.h" @@ -594,7 +589,7 @@ typedef struct #define VersionInfo16_Value( ver ) \ DWORD_ALIGN( (ver), (ver)->szKey + strlen((ver)->szKey) + 1 ) #define VersionInfo32_Value( ver ) \ - DWORD_ALIGN( (ver), (ver)->szKey + strlenW((ver)->szKey) + 1 ) + DWORD_ALIGN( (ver), (ver)->szKey + lstrlenW((ver)->szKey) + 1 ) #define VersionInfo16_Children( ver ) \ (const VS_VERSION_INFO_STRUCT16 *)( VersionInfo16_Value( ver ) + \ @@ -870,7 +865,7 @@ static const VS_VERSION_INFO_STRUCT16 *VersionInfo16_FindChild( const VS_VERSION while ((char *)child < (char *)info + info->wLength ) { - if (!strncasecmp( child->szKey, szKey, cbKey ) && !child->szKey[cbKey]) + if (!_strnicmp( child->szKey, szKey, cbKey ) && !child->szKey[cbKey]) return child; if (!(child->wLength)) return NULL; @@ -890,7 +885,7 @@ static const VS_VERSION_INFO_STRUCT32 *VersionInfo32_FindChild( const VS_VERSION while ((char *)child < (char *)info + info->wLength ) { - if (!strncmpiW( child->szKey, szKey, cbKey ) && !child->szKey[cbKey]) + if (!_wcsnicmp( child->szKey, szKey, cbKey ) && !child->szKey[cbKey]) return child; if (!(child->wLength)) return NULL; @@ -1087,7 +1082,7 @@ BOOL WINAPI VerQueryValueW( LPCVOID pBlock, LPCWSTR lpSubBlock, HeapFree(GetProcessHeap(), 0, lpSubBlockA); - if (ret && strcmpiW( lpSubBlock, rootW ) && strcmpiW( lpSubBlock, varfileinfoW )) + if (ret && wcsicmp( lpSubBlock, rootW ) && wcsicmp( lpSubBlock, varfileinfoW )) { /* Set lpBuffer so it points to the 'empty' area where we store * the converted strings @@ -1360,8 +1355,8 @@ DWORD WINAPI VerFindFileW( DWORD flags,LPCWSTR lpszFilename,LPCWSTR lpszWinDir, if (lpszFilename && !testFileExistenceW(curDir, lpszFilename, TRUE)) retval |= VFF_FILEINUSE; - curDirSizeReq = strlenW(curDir) + 1; - destDirSizeReq = strlenW(destDir) + 1; + curDirSizeReq = lstrlenW(curDir) + 1; + destDirSizeReq = lstrlenW(destDir) + 1; /* Make sure that the pointers to the size of the buffers are valid; if not, do NOTHING with that buffer. If that pointer diff --git a/media/doc/README.WINE b/media/doc/README.WINE index c7d47ba6730..050a8fe31c8 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -193,7 +193,7 @@ dll/win32/urlmon # Synced to WineStaging-4.18 dll/win32/usp10 # Synced to WineStaging-4.18 dll/win32/uxtheme # Forked dll/win32/vbscript # Synced to WineStaging-4.18 -dll/win32/version # Synced to WineStaging-4.0 +dll/win32/version # Synced to WineStaging-4.18 dll/win32/vssapi # Synced to WineStaging-2.9 dll/win32/wbemdisp # Synced to WineStaging-4.0 dll/win32/wbemprox # Synced to WineStaging-4.0
1
0
0
0
[reactos] 01/01: [VBSCRIPT_WINETEST] Sync with Wine Staging 4.18. CORE-16441
by Amine Khaldi
01 Dec '19
01 Dec '19
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7d76303d2d96afbb3a1b6…
commit 7d76303d2d96afbb3a1b6587a03127b034c8bfeb Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sun Dec 1 19:43:01 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Dec 1 19:43:01 2019 +0100 [VBSCRIPT_WINETEST] Sync with Wine Staging 4.18. CORE-16441 --- modules/rostests/winetests/vbscript/api.vbs | 184 +++++++ modules/rostests/winetests/vbscript/lang.vbs | 134 +++++ modules/rostests/winetests/vbscript/run.c | 706 +++++++++++++++++++++++-- modules/rostests/winetests/vbscript/vbscript.c | 206 +++++++- 4 files changed, 1189 insertions(+), 41 deletions(-) diff --git a/modules/rostests/winetests/vbscript/api.vbs b/modules/rostests/winetests/vbscript/api.vbs index 8ebbfb6c5c8..49dd4959f77 100644 --- a/modules/rostests/winetests/vbscript/api.vbs +++ b/modules/rostests/winetests/vbscript/api.vbs @@ -129,6 +129,16 @@ TestCStr 3, "3" if isEnglishLang then TestCStr 3.5, "3.5" if isEnglishLang then TestCStr true, "True" +sub testCStrError() + on error resume next + Error.clear() + CStr(null) + call ok(Err.number = 94, "Err.number = " & Err.number) + if isEnglishLang then call ok(Err.source = "Microsoft VBScript runtime error", "Err.source = " & Err.source) + if isEnglishLang then call ok(Err.description = "Invalid use of Null", "Err.description = " & Err.description) +end sub +call testCStrError() + Call ok(getVT(Chr(120)) = "VT_BSTR", "getVT(Chr(120)) = " & getVT(Chr(120))) Call ok(getVT(Chr(255)) = "VT_BSTR", "getVT(Chr(255)) = " & getVT(Chr(255))) Call ok(Chr(120) = "x", "Chr(120) = " & Chr(120)) @@ -144,6 +154,7 @@ sub testChrError call Err.clear() call Chr(-1) call ok(Err.number = 5, "Err.number = " & Err.number) + if isEnglishLang then call ok(Err.description = "Invalid procedure call or argument", "Err.description = " & Err.description) call Err.clear() call Chr(256) @@ -237,6 +248,19 @@ Call ok(UBound(arr2) = 2, "UBound(x) = " & UBound(x)) Call ok(UBound(arr2, 1) = 2, "UBound(x) = " & UBound(x)) Call ok(UBound(arr2, 2) = 4, "UBound(x) = " & UBound(x)) +sub testUBoundError() + on error resume next + call Err.clear() + call UBound() + call ok(Err.number = 450, "Err.number = " & Err.number) + call Err.clear() + call UBound(arr, 1, 2) + call ok(Err.number = 450, "Err.number = " & Err.number) + if isEnglishLang then call ok(Err.description = "Wrong number of arguments or invalid property assignment", _ + "Err.description = " & Err.description) +end sub +call testUBoundError() + Dim newObject Set newObject = New ValClass newObject.myval = 1 @@ -494,6 +518,17 @@ TestStrComp "ABC", Empty, 1, 1 TestStrComp vbNull, vbNull, 1, 0 TestStrComp "", vbNull, 1, -1 +sub testStrCompError() + on error resume next + call Err.clear() + call StrComp() + call ok(Err.number = 450, "Err.number = " & Err.number) + call Err.clear() + call StrComp("a", "a", 0, 1) + call ok(Err.number = 450, "Err.number = " & Err.number) +end sub +call testStrCompError() + Call ok(Len("abc") = 3, "Len(abc) = " & Len("abc")) Call ok(Len("") = 0, "Len() = " & Len("")) Call ok(Len(1) = 1, "Len(1) = " & Len(1)) @@ -1066,6 +1101,9 @@ Call ok(VarType(Null) = vbNull, "VarType(Null) = " & VarType(Null)) Call ok(getVT(VarType(Null)) = "VT_I2", "getVT(VarType(Null)) = " & getVT(VarType(Null))) Call ok(VarType(255) = vbInteger, "VarType(255) = " & VarType(255)) Call ok(getVT(VarType(255)) = "VT_I2", "getVT(VarType(255)) = " & getVT(VarType(255))) +set x = new EmptyClass +Call ok(VarType(x) = vbObject, "VarType(x) = " & VarType(x)) +Call ok(getVT(VarType(x)) = "VT_I2", "getVT(VarType(x)) = " & getVT(VarType(x))) Call ok(VarType(32768) = vbLong, "VarType(32768) = " & VarType(32768)) Call ok(getVT(VarType(32768)) = "VT_I2", "getVT(VarType(32768)) = " & getVT(VarType(32768))) Call ok(VarType(CSng(0.5)) = vbSingle, "VarType(CSng(0.5)) = " & VarType(CSng(0.5))) @@ -1080,6 +1118,8 @@ Call ok(VarType(CBool(0.5)) = vbBoolean, "VarType(CBool(0.5)) = " & VarType(CBoo Call ok(getVT(VarType(CBool(0.5))) = "VT_I2", "getVT(VarType(CBool(0.5))) = " & getVT(VarType(CBool(0.5)))) Call ok(VarType(CByte(255)) = vbByte, "VarType(CByte(255)) = " & VarType(CByte(255))) Call ok(getVT(VarType(CByte(255))) = "VT_I2", "getVT(VarType(CByte(255))) = " & getVT(VarType(CByte(255)))) +Call ok(VarType(arr) = (vbArray or vbVariant), "VarType(arr) = " & VarType(arr)) +Call ok(getVT(VarType(arr)) = "VT_I2", "getVT(VarType(arr)) = " & getVT(VarType(arr))) Call ok(Sgn(Empty) = 0, "Sgn(MyEmpty) = " & Sgn(Empty)) Call ok(getVT(Sgn(Empty)) = "VT_I2", "getVT(Sgn(MyEmpty)) = " & getVT(Sgn(Empty))) @@ -1407,6 +1447,21 @@ Call ok(getVT(Log(CByte(2))) = "VT_R8", "getVT(Log(CByte(2))) = " & getVT(Log(CB Call ok(getVT(Date) = "VT_DATE", "getVT(Date) = " & getVT(Date)) Call ok(getVT(Time) = "VT_DATE", "getVT(Time) = " & getVT(Time)) +Call ok(getVT(Day(now)) = "VT_I2", "getVT(Day(now)) = " & getVT(Day(now))) +Call ok(Day(2) = 1, "Day(2) = " & Day(2)) +Call ok(getVT(Month(now)) = "VT_I2", "getVT(Month(now)) = " & getVT(Month(now))) +Call ok(Month(2) = 1, "Month(2) = " & Month(2)) +Call ok(getVT(Year(now)) = "VT_I2", "getVT(Year(now)) = " & getVT(Year(now))) +Call ok(Year(2) = 1900, "Year(2) = " & Year(2)) +Call ok(getVT(Hour(now)) = "VT_I2", "getVT(Hour(now)) = " & getVT(Hour(now))) +Call ok(Hour(2) = 0, "Hour(2) = " & Hour(2)) +Call ok(Hour(2.75) = 18, "Hour(2) = " & Hour(2.75)) +Call ok(getVT(Minute(now)) = "VT_I2", "getVT(Minute(now)) = " & getVT(Minute(now))) +Call ok(Minute(2) = 0, "Minute(2) = " & Minute(2)) +Call ok(Minute(2.02083) = 30, "Minute(2.02083) = " & Minute(2.02083)) +Call ok(getVT(Second(now)) = "VT_I2", "getVT(Second(now)) = " & getVT(Second(now))) +Call ok(Second(2) = 0, "Second(2) = " & Second(2)) + Sub testRGBError(arg1, arg2, arg3, error_num) on error resume next Dim x @@ -1431,4 +1486,133 @@ Call testRGBError(&h4d&, -2, &h2f&, 5) Call ok(getVT(Timer) = "VT_R4", "getVT(Timer) = " & getVT(Timer)) +sub testAsc(arg, expected) + dim x + x = Asc(arg) + call ok(x = expected, "x = " & x & " expected " & expected) + call ok(getVT(x) = "VT_I2*", "getVT = " & getVT(x)) +end sub + +sub testAscError() + on error resume next + call Err.clear() + call Asc(null) + Call ok(Err.number = 94, "Err.number = " & Err.number) + call Err.clear() + call Asc(empty) + Call ok(Err.number = 5, "Err.number = " & Err.number) + call Err.clear() + call Asc() + Call ok(Err.number = 450, "Err.number = " & Err.number) + call Err.clear() + call Asc(Chr(260)) ' some versions of vista allow it + Call ok(Err.number = 5 or Err.number = 0, "asc4 Err.number = " & Err.number) + call Err.clear() + call Asc("") + Call ok(Err.number = 5, "Err.number = " & Err.number) +end sub + +call testAsc("T", 84) +call testAsc("test", 116) +call testAsc("3", 51) +call testAsc(3, 51) +call testAsc(" ", 32) +call testAsc(Chr(255), 255) +call testAsc(Chr(0), 0) +if isEnglishLang then testAsc true, 84 +call testAscError() + +sub testErrNumber(n) + call ok(err.number = n, "err.number = " & err.number & " expected " & n) +end sub + +sub testErrRaise() + on error resume next + call ok(err.number = 0, "err.number = " & err.number) + err.raise 1 + call ok(err.number = 1, "err.number = " & err.number) + err.raise + call ok(err.number = 450, "err.number = " & err.number) + call testErrNumber(450) + err.raise &h10000& + call ok(err.number = 5, "err.number = " & err.number) + + err.clear + call ok(getVT(err.source) = "VT_BSTR", "err.source = " & err.source) + call ok(getVT(err.description) = "VT_BSTR", "err.description = " & err.description) + call ok(getVT(err.helpfile) = "VT_BSTR", "err.helpfile = " & err.helpfile) + call ok(getVT(err.helpcontext) = "VT_I4", "err.helpcontext = " & err.helpcontext) + call ok(err.source = "", "err.source = " & err.source) + call ok(err.description = "", "err.description = " & err.description) + call ok(err.helpfile = "", "err.helpfile = " & err.helpfile) + call ok(err.helpcontext = 0, "err.helpcontext = " & err.helpcontext) + + err.raise 1, "abc" + call ok(err.number = 1, "err.number = " & err.number) + call ok(err.source = "abc", "err.source = " & err.source) + if isEnglishLang then call ok(err.description = "Unknown runtime error", "err.description = " & err.description) + call ok(err.helpfile = "", "err.helpfile = " & err.helpfile) + + err.raise 1, 2, "desc", "hf", 1 + call ok(err.number = 1, "err.number = " & err.number) + call ok(getVT(err.source) = "VT_BSTR", "err.source = " & err.source) + call ok(err.source = "2", "err.source = " & err.source) + call ok(err.description = "desc", "err.description = " & err.description) + call ok(err.helpfile = "hf", "err.helpfile = " & err.helpfile) + call ok(getVT(err.helpcontext) = "VT_I4", "err.helpcontext = " & err.helpcontext) + call ok(err.helpcontext = 1, "err.helpcontext = " & err.helpcontext) + + err.raise 5 + call ok(err.number = 5, "err.number = " & err.number) + call ok(err.source = "2", "err.source = " & err.source) + call ok(err.description = "desc", "err.description = " & err.description) + call ok(err.helpfile = "hf", "err.helpfile = " & err.helpfile) + call ok(getVT(err.helpcontext) = "VT_I4", "err.helpcontext = " & err.helpcontext) + call ok(err.helpcontext = 1, "err.helpcontext = " & err.helpcontext) + + err.clear + err.raise &h8007000E& + call ok(err.number = 7, "err.number = " & err.number) + if isEnglishLang then call ok(err.source = "Microsoft VBScript runtime error", "err.source = " & err.source) + if isEnglishLang then call ok(err.description = "Out of memory", "err.description = " & err.description) + call ok(err.helpfile = "", "err.helpfile = " & err.helpfile) + call ok(err.helpcontext = 0, "err.helpcontext = " & err.helpcontext) + + err.clear + err.raise 1, "test" + err.raise &h8007000E& + call ok(err.number = 7, "err.number = " & err.number) + call ok(err.source = "test", "err.source = " & err.source) + if isEnglishLang then call ok(err.description = "Unknown runtime error", "err.description = " & err.description) + call ok(err.helpfile = "", "err.helpfile = " & err.helpfile) + call ok(err.helpcontext = 0, "err.helpcontext = " & err.helpcontext) + + err.raise 1, 2, "desc", "hf", 1 + err.unknownIdent + call ok(err.number = 438, "err.number = " & err.number) + if isEnglishLang then call ok(err.source = "Microsoft VBScript runtime error", "err.source = " & err.source) + if isEnglishLang then call ok(err.description = "Object doesn't support this property or method", _ + "err.description = " & err.description) + call ok(err.helpfile = "", "err.helpfile = " & err.helpfile) + call ok(err.helpcontext = 0, "err.helpcontext = " & err.helpcontext) + + e = err + call ok(getVT(e) = "VT_I4*", "getVT(e) = " & getVT(e)) + call ok(e = 438, "e = " & e) + + err.raise 1, 2, "desc", "hf", 1 + on error goto 0 + call ok(err.number = 0, "err.number = " & err.number) + call ok(err.source = "", "err.source = " & err.source) + call ok(err.description = "", "err.description = " & err.description) + call ok(err.helpfile = "", "err.helpfile = " & err.helpfile) + call ok(err.helpcontext = 0, "err.helpcontext = " & err.helpcontext) + + dim e + e = err + call ok(getVT(e) = "VT_I4*", "getVT(e) = " & getVT(e)) + call ok(e = 0, "e = " & e) +end sub +call testErrRaise() + Call reportSuccess() diff --git a/modules/rostests/winetests/vbscript/lang.vbs b/modules/rostests/winetests/vbscript/lang.vbs index 2af77bdfcc4..6ddb2e79f51 100644 --- a/modules/rostests/winetests/vbscript/lang.vbs +++ b/modules/rostests/winetests/vbscript/lang.vbs @@ -41,6 +41,7 @@ Call ok(10. = 10, "10. <> 10") Call ok(&hffFFffFF& = -1, "&hffFFffFF& <> -1") Call ok(&hffFFffFF& = -1, "&hffFFffFF& <> -1") Call ok(34e5 = 3400000, "34e5 <> 3400000") +Call ok(34e+5 = 3400000, "34e+5 <> 3400000") Call ok(56.789e5 = 5678900, "56.789e5 = 5678900") Call ok(56.789e-2 = 0.56789, "56.789e-2 <> 0.56789") Call ok(1e-94938484 = 0, "1e-... <> 0") @@ -1093,6 +1094,14 @@ Call ok(getVT(cs) = "VT_BSTR", "getVT(cs) = " & getVT(cs)) Call ok(isNull(cnull), "cnull = " & cnull) Call ok(getVT(cnull) = "VT_NULL", "getVT(cnull) = " & getVT(cnull)) +Call ok(+1 = 1, "+1 != 1") +Call ok(+true = true, "+1 != 1") +Call ok(getVT(+true) = "VT_BOOL", "getVT(+true) = " & getVT(+true)) +Call ok(+"true" = "true", """+true"" != true") +Call ok(getVT(+"true") = "VT_BSTR", "getVT(+""true"") = " & getVT(+"true")) +Call ok(+obj is obj, "+obj != obj") +Call ok(+--+-+1 = -1, "+--+-+1 != -1") + if false then Const conststr = "str" Call ok(conststr = "str", "conststr = " & conststr) Call ok(getVT(conststr) = "VT_BSTR", "getVT(conststr) = " & getVT(conststr)) @@ -1345,4 +1354,129 @@ end class set x = new RegExp Call ok(x.Global = false, "x.Global = " & x.Global) +sub test_nothing_errors + dim x + on error resume next + + x = 1 + err.clear + x = nothing + call ok(err.number = 91, "err.number = " & err.number) + call ok(x = 1, "x = " & x) + + err.clear + x = not nothing + call ok(err.number = 91, "err.number = " & err.number) + call ok(x = 1, "x = " & x) + + err.clear + x = "" & nothing + call ok(err.number = 91, "err.number = " & err.number) + call ok(x = 1, "x = " & x) +end sub +call test_nothing_errors() + +sub test_identifiers + ' test keywords that can also be a declared identifier + Dim default + default = "xx" + Call ok(default = "xx", "default = " & default & " expected ""xx""") + + Dim error + error = "xx" + Call ok(error = "xx", "error = " & error & " expected ""xx""") + + Dim explicit + explicit = "xx" + Call ok(explicit = "xx", "explicit = " & explicit & " expected ""xx""") + + Dim step + step = "xx" + Call ok(step = "xx", "step = " & step & " expected ""xx""") +end sub +call test_identifiers() + +sub test_dotIdentifiers + ' test keywords that can also be an identifier after a dot + ' Call ok(testObj.rem = 10, "testObj.rem = " & testObj.rem & " expected 10") + Call ok(testObj.true = 10, "testObj.true = " & testObj.true & " expected 10") + Call ok(testObj.false = 10, "testObj.false = " & testObj.false & " expected 10") + Call ok(testObj.not = 10, "testObj.not = " & testObj.not & " expected 10") + Call ok(testObj.and = 10, "testObj.and = " & testObj.and & " expected 10") + Call ok(testObj.or = 10, "testObj.or = " & testObj.or & " expected 10") + Call ok(testObj.xor = 10, "testObj.xor = " & testObj.xor & " expected 10") + Call ok(testObj.eqv = 10, "testObj.eqv = " & testObj.eqv & " expected 10") + Call ok(testObj.imp = 10, "testObj.imp = " & testObj.imp & " expected 10") + Call ok(testObj.is = 10, "testObj.is = " & testObj.is & " expected 10") + Call ok(testObj.mod = 10, "testObj.mod = " & testObj.mod & " expected 10") + Call ok(testObj.call = 10, "testObj.call = " & testObj.call & " expected 10") + Call ok(testObj.dim = 10, "testObj.dim = " & testObj.dim & " expected 10") + Call ok(testObj.sub = 10, "testObj.sub = " & testObj.sub & " expected 10") + Call ok(testObj.function = 10, "testObj.function = " & testObj.function & " expected 10") + Call ok(testObj.get = 10, "testObj.get = " & testObj.get & " expected 10") + Call ok(testObj.let = 10, "testObj.let = " & testObj.let & " expected 10") + Call ok(testObj.const = 10, "testObj.const = " & testObj.const & " expected 10") + Call ok(testObj.if = 10, "testObj.if = " & testObj.if & " expected 10") + Call ok(testObj.else = 10, "testObj.else = " & testObj.else & " expected 10") + Call ok(testObj.elseif = 10, "testObj.elseif = " & testObj.elseif & " expected 10") + Call ok(testObj.end = 10, "testObj.end = " & testObj.end & " expected 10") + Call ok(testObj.then = 10, "testObj.then = " & testObj.then & " expected 10") + Call ok(testObj.exit = 10, "testObj.exit = " & testObj.exit & " expected 10") + Call ok(testObj.while = 10, "testObj.while = " & testObj.while & " expected 10") + Call ok(testObj.wend = 10, "testObj.wend = " & testObj.wend & " expected 10") + Call ok(testObj.do = 10, "testObj.do = " & testObj.do & " expected 10") + Call ok(testObj.loop = 10, "testObj.loop = " & testObj.loop & " expected 10") + Call ok(testObj.until = 10, "testObj.until = " & testObj.until & " expected 10") + Call ok(testObj.for = 10, "testObj.for = " & testObj.for & " expected 10") + Call ok(testObj.to = 10, "testObj.to = " & testObj.to & " expected 10") + Call ok(testObj.each = 10, "testObj.each = " & testObj.each & " expected 10") + Call ok(testObj.in = 10, "testObj.in = " & testObj.in & " expected 10") + Call ok(testObj.select = 10, "testObj.select = " & testObj.select & " expected 10") + Call ok(testObj.case = 10, "testObj.case = " & testObj.case & " expected 10") + Call ok(testObj.byref = 10, "testObj.byref = " & testObj.byref & " expected 10") + Call ok(testObj.byval = 10, "testObj.byval = " & testObj.byval & " expected 10") + Call ok(testObj.option = 10, "testObj.option = " & testObj.option & " expected 10") + Call ok(testObj.nothing = 10, "testObj.nothing = " & testObj.nothing & " expected 10") + Call ok(testObj.empty = 10, "testObj.empty = " & testObj.empty & " expected 10") + Call ok(testObj.null = 10, "testObj.null = " & testObj.null & " expected 10") + Call ok(testObj.class = 10, "testObj.class = " & testObj.class & " expected 10") + Call ok(testObj.set = 10, "testObj.set = " & testObj.set & " expected 10") + Call ok(testObj.new = 10, "testObj.new = " & testObj.new & " expected 10") + Call ok(testObj.public = 10, "testObj.public = " & testObj.public & " expected 10") + Call ok(testObj.private = 10, "testObj.private = " & testObj.private & " expected 10") + Call ok(testObj.next = 10, "testObj.next = " & testObj.next & " expected 10") + Call ok(testObj.on = 10, "testObj.on = " & testObj.on & " expected 10") + Call ok(testObj.resume = 10, "testObj.resume = " & testObj.resume & " expected 10") + Call ok(testObj.goto = 10, "testObj.goto = " & testObj.goto & " expected 10") +end sub +call test_dotIdentifiers + +' Test End statements not required to be preceeded by a newline or separator +Sub EndTestSub + x = 1 End Sub + +Sub EndTestSubWithCall + x = 1 + Call ok(x = 1, "x = " & x)End Sub +Call EndTestSubWithCall() + +Function EndTestFunc(x) + Call ok(x > 0, "x = " & x)End Function +EndTestFunc(1) + +Class EndTestClassWithStorageId + Public x End Class + +Class EndTestClassWithDim + Dim x End Class + +Class EndTestClassWithFunc + Function test(ByVal x) + x = 0 End Function End Class + +Class EndTestClassWithProperty + Public x + Public default Property Get defprop + defprop = x End Property End Class + reportSuccess() diff --git a/modules/rostests/winetests/vbscript/run.c b/modules/rostests/winetests/vbscript/run.c index 191f5a79a0d..2d34a8c80f2 100644 --- a/modules/rostests/winetests/vbscript/run.c +++ b/modules/rostests/winetests/vbscript/run.c @@ -58,6 +58,9 @@ extern const CLSID CLSID_VBScriptRegExp; #define SET_EXPECT(func) \ expect_ ## func = TRUE +#define REF_EXPECT(func) \ + (&expect_ ## func), (&called_ ## func) + #define CHECK_EXPECT2(func) \ do { \ ok(expect_ ##func, "unexpected call " #func "\n"); \ @@ -76,6 +79,12 @@ extern const CLSID CLSID_VBScriptRegExp; expect_ ## func = called_ ## func = FALSE; \ }while(0) +#define CHECK_NOT_CALLED(func) \ + do { \ + ok(!called_ ## func, "unexpected " #func "\n"); \ + expect_ ## func = called_ ## func = FALSE; \ + }while(0) + #define CLEAR_CALLED(func) \ expect_ ## func = called_ ## func = FALSE @@ -85,6 +94,7 @@ DEFINE_EXPECT(global_vbvar_d); DEFINE_EXPECT(global_vbvar_i); DEFINE_EXPECT(global_letobj_i); DEFINE_EXPECT(global_setobj_i); +DEFINE_EXPECT(global_globalcallback_i); DEFINE_EXPECT(testobj_propget_d); DEFINE_EXPECT(testobj_propget_i); DEFINE_EXPECT(testobj_propput_d); @@ -95,12 +105,15 @@ DEFINE_EXPECT(global_propargput_i); DEFINE_EXPECT(global_propargput1_d); DEFINE_EXPECT(global_propargput1_i); DEFINE_EXPECT(global_testoptionalarg_i); +DEFINE_EXPECT(global_testerrorobject_i); DEFINE_EXPECT(collectionobj_newenum_i); DEFINE_EXPECT(Next); DEFINE_EXPECT(GetWindow); DEFINE_EXPECT(GetUIBehavior); DEFINE_EXPECT(EnableModeless); DEFINE_EXPECT(OnScriptError); +DEFINE_EXPECT(OnEnterScript); +DEFINE_EXPECT(OnLeaveScript); #define DISPID_GLOBAL_REPORTSUCCESS 1000 #define DISPID_GLOBAL_TRACE 1001 @@ -124,9 +137,12 @@ DEFINE_EXPECT(OnScriptError); #define DISPID_GLOBAL_SETOBJ 1019 #define DISPID_GLOBAL_TODO_WINE_OK 1020 #define DISPID_GLOBAL_WEEKSTARTDAY 1021 +#define DISPID_GLOBAL_GLOBALCALLBACK 1022 +#define DISPID_GLOBAL_TESTERROROBJECT 1023 #define DISPID_TESTOBJ_PROPGET 2000 #define DISPID_TESTOBJ_PROPPUT 2001 +#define DISPID_TESTOBJ_KEYWORD 2002 #define DISPID_COLLOBJ_RESET 3000 @@ -143,6 +159,7 @@ static int test_counter; static SCRIPTUICHANDLING uic_handling = SCRIPTUICHANDLING_NOUIERROR; static IDispatchEx testObj; static HRESULT onerror_hres = E_NOTIMPL; +static BOOL strict_enter_script; static BSTR a2bstr(const char *str) { @@ -163,6 +180,13 @@ static int strcmp_wa(LPCWSTR strw, const char *stra) return lstrcmpA(buf, stra); } +static int stricmp_wa(LPCWSTR strw, const char *stra) +{ + CHAR buf[512]; + WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), 0, 0); + return lstrcmpiA(buf, stra); +} + static const char *vt2a(VARIANT *v) { if(V_VT(v) == (VT_BYREF|VT_VARIANT)) { @@ -685,7 +709,6 @@ static HRESULT WINAPI DispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pcti static HRESULT WINAPI DispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) { - ok(0, "unexpected call\n"); return E_NOTIMPL; } @@ -756,17 +779,81 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc static HRESULT WINAPI testObj_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid) { - if(!strcmp_wa(bstrName, "propget")) { - CHECK_EXPECT(testobj_propget_d); - test_grfdex(grfdex, fdexNameCaseInsensitive); - *pid = DISPID_TESTOBJ_PROPGET; - return S_OK; - } - if(!strcmp_wa(bstrName, "propput")) { - CHECK_EXPECT(testobj_propput_d); - test_grfdex(grfdex, fdexNameCaseInsensitive); - *pid = DISPID_TESTOBJ_PROPPUT; - return S_OK; + typedef struct { + const char * const name; + DISPID pid; + BOOL *expect; + BOOL *called; + } dispid_t; + + dispid_t dispids[] = { + { "propget", DISPID_TESTOBJ_PROPGET, REF_EXPECT(testobj_propget_d) }, + { "propput", DISPID_TESTOBJ_PROPPUT, REF_EXPECT(testobj_propput_d) }, + { "rem", DISPID_TESTOBJ_KEYWORD, NULL }, + { "true", DISPID_TESTOBJ_KEYWORD, NULL }, + { "false", DISPID_TESTOBJ_KEYWORD, NULL }, + { "not", DISPID_TESTOBJ_KEYWORD, NULL }, + { "and", DISPID_TESTOBJ_KEYWORD, NULL }, + { "or", DISPID_TESTOBJ_KEYWORD, NULL }, + { "xor", DISPID_TESTOBJ_KEYWORD, NULL }, + { "eqv", DISPID_TESTOBJ_KEYWORD, NULL }, + { "imp", DISPID_TESTOBJ_KEYWORD, NULL }, + { "is", DISPID_TESTOBJ_KEYWORD, NULL }, + { "mod", DISPID_TESTOBJ_KEYWORD, NULL }, + { "call", DISPID_TESTOBJ_KEYWORD, NULL }, + { "dim", DISPID_TESTOBJ_KEYWORD, NULL }, + { "sub", DISPID_TESTOBJ_KEYWORD, NULL }, + { "function", DISPID_TESTOBJ_KEYWORD, NULL }, + { "get", DISPID_TESTOBJ_KEYWORD, NULL }, + { "let", DISPID_TESTOBJ_KEYWORD, NULL }, + { "const", DISPID_TESTOBJ_KEYWORD, NULL }, + { "if", DISPID_TESTOBJ_KEYWORD, NULL }, + { "else", DISPID_TESTOBJ_KEYWORD, NULL }, + { "elseif", DISPID_TESTOBJ_KEYWORD, NULL }, + { "end", DISPID_TESTOBJ_KEYWORD, NULL }, + { "then", DISPID_TESTOBJ_KEYWORD, NULL }, + { "exit", DISPID_TESTOBJ_KEYWORD, NULL }, + { "while", DISPID_TESTOBJ_KEYWORD, NULL }, + { "wend", DISPID_TESTOBJ_KEYWORD, NULL }, + { "do", DISPID_TESTOBJ_KEYWORD, NULL }, + { "loop", DISPID_TESTOBJ_KEYWORD, NULL }, + { "until", DISPID_TESTOBJ_KEYWORD, NULL }, + { "for", DISPID_TESTOBJ_KEYWORD, NULL }, + { "to", DISPID_TESTOBJ_KEYWORD, NULL }, + { "each", DISPID_TESTOBJ_KEYWORD, NULL }, + { "in", DISPID_TESTOBJ_KEYWORD, NULL }, + { "select", DISPID_TESTOBJ_KEYWORD, NULL }, + { "case", DISPID_TESTOBJ_KEYWORD, NULL }, + { "byref", DISPID_TESTOBJ_KEYWORD, NULL }, + { "byval", DISPID_TESTOBJ_KEYWORD, NULL }, + { "option", DISPID_TESTOBJ_KEYWORD, NULL }, + { "nothing", DISPID_TESTOBJ_KEYWORD, NULL }, + { "empty", DISPID_TESTOBJ_KEYWORD, NULL }, + { "null", DISPID_TESTOBJ_KEYWORD, NULL }, + { "class", DISPID_TESTOBJ_KEYWORD, NULL }, + { "set", DISPID_TESTOBJ_KEYWORD, NULL }, + { "new", DISPID_TESTOBJ_KEYWORD, NULL }, + { "public", DISPID_TESTOBJ_KEYWORD, NULL }, + { "private", DISPID_TESTOBJ_KEYWORD, NULL }, + { "next", DISPID_TESTOBJ_KEYWORD, NULL }, + { "on", DISPID_TESTOBJ_KEYWORD, NULL }, + { "resume", DISPID_TESTOBJ_KEYWORD, NULL }, + { "goto", DISPID_TESTOBJ_KEYWORD, NULL }, + }; + int i; + + for (i = 0; i < ARRAY_SIZE(dispids); i++) { + if(!stricmp_wa(bstrName, dispids[i].name)) { + dispid_t *d = &dispids[i]; + if(d->expect) { + ok(*d->expect, "unexpected call %s\n", d->name); + *d->called = TRUE; + *d->expect = FALSE; + } + test_grfdex(grfdex, fdexNameCaseInsensitive); + *pid = d->pid; + return S_OK; + } } ok(0, "unexpected call %s\n", wine_dbgstr_w(bstrName)); @@ -831,6 +918,11 @@ static HRESULT WINAPI testObj_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, ok(V_VT(pdp->rgvarg) == VT_I2, "V_VT(psp->rgvargs) = %d\n", V_VT(pdp->rgvarg)); ok(V_I2(pdp->rgvarg) == 1, "V_I2(psp->rgvargs) = %d\n", V_I2(pdp->rgvarg)); return S_OK; + + case DISPID_TESTOBJ_KEYWORD: + V_VT(pvarRes) = VT_I2; + V_I2(pvarRes) = 10; + return S_OK; } ok(0, "unexpected call %d\n", id); @@ -1024,6 +1116,11 @@ static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD *pid = DISPID_GLOBAL_WEEKSTARTDAY; return S_OK; } + if(!strcmp_wa(bstrName, "globalCallback")) { + test_grfdex(grfdex, fdexNameCaseInsensitive); + *pid = DISPID_GLOBAL_GLOBALCALLBACK; + return S_OK; + } if(!strcmp_wa(bstrName, "testObj")) { test_grfdex(grfdex, fdexNameCaseInsensitive); *pid = DISPID_GLOBAL_TESTOBJ; @@ -1102,6 +1199,11 @@ static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD *pid = DISPID_GLOBAL_TESTOPTIONALARG; return S_OK; } + if(!strcmp_wa(bstrName, "testErrorObject")) { + test_grfdex(grfdex, fdexNameCaseInsensitive); + *pid = DISPID_GLOBAL_TESTERROROBJECT; + return S_OK; + } if(strict_dispid_check && strcmp_wa(bstrName, "x")) ok(0, "unexpected call %s %x\n", wine_dbgstr_w(bstrName), grfdex); @@ -1480,6 +1582,115 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, ok(V_ERROR(v) == DISP_E_PARAMNOTFOUND, "V_ERROR(v) = %08x\n", V_ERROR(v)); return S_OK; } + case DISPID_GLOBAL_GLOBALCALLBACK: { + DISPPARAMS dp = {0}; + IDispatchEx *dispex; + EXCEPINFO ei; + VARIANT v; + DISPID id; + BSTR str; + HRESULT hres; + + CHECK_EXPECT(global_globalcallback_i); + CHECK_CALLED(OnEnterScript); + + ok(wFlags == INVOKE_FUNC, "wFlags = %x\n", wFlags); + ok(pdp != NULL, "pdp == NULL\n"); + ok(pdp->rgvarg != NULL, "rgvarg == NULL\n"); + ok(V_VT(pdp->rgvarg) == VT_DISPATCH, "V_VT(pdp->rgvarg) = %d\n", V_VT(pdp->rgvarg)); + ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n"); + ok(pdp->cArgs == 1, "cArgs = %d\n", pdp->cArgs); + ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs); + ok(!pvarRes, "pvarRes != NULL\n"); + ok(pei != NULL, "pei == NULL\n"); + + hres = IDispatch_QueryInterface(V_DISPATCH(pdp->rgvarg), &IID_IDispatchEx, (void**)&dispex); + ok(hres == S_OK, "Could not get IDispatchEx iface: %08x\n", hres); + + str = SysAllocString(L"callback"); + hres = IDispatchEx_GetDispID(dispex, str, fdexNameCaseInsensitive, &id); + ok(hres == S_OK, "GetDispID failed: %08x\n", hres); + SysFreeString(str); + + SET_EXPECT(OnEnterScript); + SET_EXPECT(OnLeaveScript); + memset(&ei, 0, sizeof(ei)); + hres = IDispatchEx_InvokeEx(dispex, id, 0, DISPATCH_METHOD, &dp, &v, &ei, pspCaller); + ok(hres == S_OK, "InvokeEx failed: %08x\n", hres); + CHECK_CALLED(OnEnterScript); + CHECK_CALLED(OnLeaveScript); + ok(V_VT(&v) == VT_BOOL, "V_VT(v) = %d\n", V_VT(&v)); + ok(V_BOOL(&v) == VARIANT_TRUE, "V_BOOL(v) = %x\n", V_BOOL(&v)); + + IDispatchEx_Release(dispex); + + SET_EXPECT(OnLeaveScript); + return S_OK; + } + case DISPID_GLOBAL_TESTERROROBJECT: { + ITypeInfo *typeinfo; + IDispatchEx *dispex; + DISPPARAMS dp; + VARIANT v, r; + EXCEPINFO ei; + IDispatch *disp; + WCHAR *names[1]; + UINT count, i; + DISPID id; + HRESULT hres; + + static WCHAR props[][32] = { L"clear", L"description", L"helpcontext", L"helpFILE", L"number", L"raise", L"source" }; + + CHECK_EXPECT(global_testerrorobject_i); + + ok(wFlags == INVOKE_FUNC, "wFlags = %x\n", wFlags); + ok(pdp != NULL, "pdp == NULL\n"); + ok(pdp->rgvarg != NULL, "rgvarg == NULL\n"); + ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n"); + ok(pdp->cArgs == 1, "cArgs = %d\n", pdp->cArgs); + ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs); + ok(!pvarRes, "pvarRes != NULL\n"); + ok(pei != NULL, "pei == NULL\n"); + + ok(V_VT(pdp->rgvarg) == VT_DISPATCH, "V_VT(pdp->rgvarg) = %d\n", V_VT(pdp->rgvarg)); + disp = V_DISPATCH(pdp->rgvarg); + hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex); + ok(hres == E_NOINTERFACE, "Could not get IDispatchEx iface: %08x\n", hres); + + hres = IDispatch_GetTypeInfoCount(disp, &count); + ok(hres == S_OK, "GetTypeInfoCount returned: %08x\n", hres); + ok(count == 0, "count = %u\n", count); + + hres = IDispatch_GetTypeInfo(disp, 0, 0, &typeinfo); + ok(hres == DISP_E_BADINDEX, "GetTypeInfo returned: %08x\n", hres); + + for(i = 0; i < ARRAY_SIZE(props); i++) { + names[0] = props[i]; + hres = IDispatch_GetIDsOfNames(disp, &IID_NULL, names, 1, 0, &id); + ok(hres == S_OK, "GetIDsOfNames failed: %08x\n", hres); + ok(id == i + 1, "%s id = %u\n", wine_dbgstr_w(props[i]), id); + } + + memset(&dp, 0, sizeof(dp)); + memset(&ei, 0, sizeof(ei)); + V_VT(&v) = VT_ERROR; + hres = IDispatch_Invoke(disp, 5, &IID_NULL, 0, DISPATCH_PROPERTYGET, &dp, &v, &ei, NULL); + ok(hres == S_OK, "Invoke failed: %08x\n", hres); + ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v)); + ok(V_I4(&v) == 1, "V_I4(v) = %d\n", V_I4(&v)); + hres = IDispatch_Invoke(disp, DISPID_VALUE, &IID_NULL, 0, DISPATCH_PROPERTYGET, &dp, &v, &ei, NULL); + ok(hres == S_OK, "Invoke failed: %08x\n", hres); + ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v)); + ok(V_I4(&v) == 1, "V_I4(v) = %d\n", V_I4(&v)); + + dp.rgvarg = &v; + V_VT(&v) = VT_I4; + V_I4(&v) = 6; + V_VT(&r) = VT_EMPTY; + hres = IDispatch_Invoke(disp, DISPID_VALUE, &IID_NULL, 6, DISPATCH_METHOD|DISPATCH_PROPERTYGET, &dp, &r, &ei, NULL); + ok(hres == S_OK, "Invoke failed: %08x\n", hres); + return S_OK; + } } ok(0, "unexpected call %d\n", id); @@ -1651,9 +1862,11 @@ static HRESULT WINAPI ActiveScriptSite_OnStateChange(IActiveScriptSite *iface, S return E_NOTIMPL; } +static IActiveScriptError **store_script_error; + static HRESULT WINAPI ActiveScriptSite_OnScriptError(IActiveScriptSite *iface, IActiveScriptError *pscripterror) { - HRESULT hr = onerror_hres; + HRESULT hr = onerror_hres, hres; if(!expect_OnScriptError) { EXCEPINFO info; @@ -1664,7 +1877,18 @@ static HRESULT WINAPI ActiveScriptSite_OnScriptError(IActiveScriptSite *iface, I if(SUCCEEDED(hres)) hres = IActiveScriptError_GetExceptionInfo(pscripterror, &info); if(SUCCEEDED(hres)) - trace("Error in line %u: %s\n", line+1, wine_dbgstr_w(info.bstrDescription)); + trace("Error in line %u: %x %s\n", line+1, info.wCode, wine_dbgstr_w(info.bstrDescription)); + }else { + IDispatchEx *dispex; + + hres = IActiveScriptError_QueryInterface(pscripterror, &IID_IDispatchEx, (void**)&dispex); + ok(hres == E_NOINTERFACE, "QI(IDispatchEx) returned: %08x\n", hres); + } + + if(store_script_error) { + IActiveScriptError_AddRef(pscripterror); + *store_script_error = pscripterror; + store_script_error = NULL; } CHECK_EXPECT(OnScriptError); @@ -1675,16 +1899,18 @@ static HRESULT WINAPI ActiveScriptSite_OnScriptError(IActiveScriptSite *iface, I static HRESULT WINAPI ActiveScriptSite_OnEnterScript(IActiveScriptSite *iface) { + if(strict_enter_script) + CHECK_EXPECT(OnEnterScript); return E_NOTIMPL; } static HRESULT WINAPI ActiveScriptSite_OnLeaveScript(IActiveScriptSite *iface) { + if(strict_enter_script) + CHECK_EXPECT(OnLeaveScript); return E_NOTIMPL; } -#undef ACTSCPSITE_THIS - static const IActiveScriptSiteVtbl ActiveScriptSiteVtbl = { ActiveScriptSite_QueryInterface, ActiveScriptSite_AddRef, @@ -1713,7 +1939,7 @@ static IActiveScript *create_script(void) return script; } -static IActiveScript *create_and_init_script(DWORD flags) +static IActiveScript *create_and_init_script(DWORD flags, BOOL start) { IActiveScriptParse *parser; IActiveScript *engine; @@ -1738,8 +1964,11 @@ static IActiveScript *create_and_init_script(DWORD flags) SCRIPTITEM_ISVISIBLE|SCRIPTITEM_ISSOURCE|flags); ok(hres == S_OK, "AddNamedItem failed: %08x\n", hres); - hres = IActiveScript_SetScriptState(engine, SCRIPTSTATE_STARTED); - ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_STARTED) failed: %08x\n", hres); + if (start) + { + hres = IActiveScript_SetScriptState(engine, SCRIPTSTATE_STARTED); + ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_STARTED) failed: %08x\n", hres); + } return engine; } @@ -1764,7 +1993,7 @@ static HRESULT parse_script(DWORD flags, BSTR script_str, const WCHAR *delim) LONG ref; HRESULT hres; - engine = create_and_init_script(flags); + engine = create_and_init_script(flags, TRUE); if(!engine) return S_OK; @@ -1828,13 +2057,17 @@ static void test_parse_context(void) static const WCHAR yW[] = {'y',0}; global_ref = 1; - engine = create_and_init_script(0); + engine = create_and_init_script(0, TRUE); if(!engine) return; hres = IActiveScript_QueryInterface(engine, &IID_IActiveScriptParse, (void**)&parser); ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres); + /* NULL code text succeeds but does nothing */ + hres = IActiveScriptParse_ParseScriptText(parser, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL); + ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres); + /* unknown identifier context is not a valid argument */ str = a2bstr("Call reportSuccess()\n"); hres = IActiveScriptParse_ParseScriptText(parser, str, yW, NULL, NULL, 0, 0, 0, NULL, NULL); @@ -1891,7 +2124,7 @@ static void _parse_htmlscript_a(unsigned line, const char *src) ok_(__FILE__,line)(hres == S_OK, "parse_script failed: %08x\n", hres); } -static IDispatchEx *parse_procedure(IActiveScriptParseProcedure2 *parse_proc, const char *src) +static IDispatchEx *parse_procedure(IActiveScriptParseProcedure2 *parse_proc, const char *src, DWORD flags) { IDispatchEx *dispex; IDispatch *disp; @@ -1902,7 +2135,7 @@ static IDispatchEx *parse_procedure(IActiveScriptParseProcedure2 *parse_proc, co str = a2bstr(src); hres = IActiveScriptParseProcedure2_ParseProcedureText(parse_proc, str, NULL, emptyW, NULL, NULL, delimiterW, 0, 0, - SCRIPTPROC_HOSTMANAGESSOURCE|SCRIPTPROC_IMPLICIT_THIS|SCRIPTPROC_IMPLICIT_PARENTS, &disp); + SCRIPTPROC_HOSTMANAGESSOURCE|SCRIPTPROC_IMPLICIT_THIS|SCRIPTPROC_IMPLICIT_PARENTS|flags, &disp); SysFreeString(str); ok(hres == S_OK, "ParseProcedureText failed: %08x\n", hres); ok(disp != NULL, "disp = NULL\n"); @@ -1921,26 +2154,220 @@ static void test_procedures(void) DISPPARAMS dp = {NULL}; IActiveScript *script; IDispatchEx *proc; + IDispatch *disp; EXCEPINFO ei = {0}; VARIANT v; HRESULT hres; - script = create_and_init_script(0); + strict_enter_script = TRUE; + script = create_and_init_script(0, TRUE); hres = IActiveScript_QueryInterface(script, &IID_IActiveScriptParseProcedure2, (void**)&parse_proc); ok(hres == S_OK, "Could not get IActiveScriptParseProcedure2 iface: %08x\n", hres); - proc = parse_procedure(parse_proc, "dim x\nif true then x=false"); + hres = IActiveScriptParseProcedure2_ParseProcedureText(parse_proc, NULL, NULL, emptyW, NULL, NULL, NULL, 0, 0, 0, &disp); + ok(hres == S_OK, "ParseProcedureText failed: %08x\n", hres); + IDispatch_Release(disp); + + proc = parse_procedure(parse_proc, "dim x\nif true then x=false", 0); + SET_EXPECT(OnEnterScript); + SET_EXPECT(OnLeaveScript); V_VT(&v) = VT_EMPTY; hres = IDispatchEx_InvokeEx(proc, DISPID_VALUE, 0, DISPATCH_METHOD, &dp, &v, &ei, &caller_sp); ok(hres == S_OK, "InvokeEx failed: %08x\n", hres); + CHECK_CALLED(OnEnterScript); + CHECK_CALLED(OnLeaveScript); + VariantClear(&v); + IDispatchEx_Release(proc); + + proc = parse_procedure(parse_proc, "\"foobar\"", SCRIPTPROC_ISEXPRESSION); + SET_EXPECT(OnEnterScript); + SET_EXPECT(OnLeaveScript); + hres = IDispatchEx_InvokeEx(proc, DISPID_VALUE, 0, DISPATCH_METHOD, &dp, &v, &ei, &caller_sp); + ok(hres == S_OK, "InvokeEx failed: %08x\n", hres); + CHECK_CALLED(OnEnterScript); + CHECK_CALLED(OnLeaveScript); + ok(V_VT(&v) == VT_BSTR, "Expected VT_BSTR, got %s\n", vt2a(&v)); + ok(!strcmp_wa(V_BSTR(&v), "foobar"), "Wrong string, got %s\n", wine_dbgstr_w(V_BSTR(&v))); + VariantClear(&v); IDispatchEx_Release(proc); IActiveScriptParseProcedure2_Release(parse_proc); close_script(script); + strict_enter_script = FALSE; +} + +static void free_ei(EXCEPINFO *ei) +{ + SysFreeString(ei->bstrSource); + SysFreeString(ei->bstrDescription); + SysFreeString(ei->bstrHelpFile); +} + +static void test_callbacks(void) +{ + IActiveScriptError *error1, *error2; + IActiveScriptParse *parser; + DISPPARAMS dp = {NULL}; + IActiveScript *script; + IDispatchEx *dispex; + IDispatch *disp; + DISPID id; + EXCEPINFO ei = {0}; + BSTR str; + VARIANT v; + HRESULT hres; + + strict_enter_script = TRUE; + script = create_and_init_script(SCRIPTITEM_GLOBALMEMBERS, TRUE); + + hres = IActiveScript_QueryInterface(script, &IID_IActiveScriptParse, (void**)&parser); + ok(hres == S_OK, "Could not get IActiveScriptParseProcedure2 iface: %08x\n", hres); + + SET_EXPECT(OnEnterScript); + SET_EXPECT(OnLeaveScript); + hres = IActiveScriptParse_ParseScriptText(parser, + L"class CallbackClass\n" + L" public function callback()\n" + L" call ok(err.number = 2, \"err.number = \" & err.number)\n" + L" callback = true\n" + L" end function\n" + L"end class\n" + L"function callGlobalCallback()\n" + L" on error resume next\n" + L" err.raise 2\n" + L" call test.globalCallback(new CallbackClass)\n" + L" call ok(err.number = 2, \"err.number = \" & err.numner)\n" + L"end function\n", + NULL, NULL, NULL, 0, 0, 0, NULL, NULL); + ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres); + CHECK_CALLED(OnEnterScript); + CHECK_CALLED(OnLeaveScript); + + hres = IActiveScript_GetScriptDispatch(script, NULL, &disp); + ok(hres == S_OK, "GetScriptDispatch failed: %08x\n", hres); + + hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex); + ok(hres == S_OK, "Could not get IDispatchEx iface: %08x\n", hres); + IDispatch_Release(disp); + + str = SysAllocString(L"callGlobalCallback"); + hres = IDispatchEx_GetDispID(dispex, str, fdexNameCaseInsensitive, &id); + ok(hres == S_OK, "GetDispID failed: %08x\n", hres); + SysFreeString(str); + + SET_EXPECT(OnEnterScript); + /* OnLeaveScript will be set in global callback */ + SET_EXPECT(global_globalcallback_i); + hres = IDispatchEx_InvokeEx(dispex, id, 0, DISPATCH_METHOD, &dp, &v, &ei, &caller_sp); + ok(hres == S_OK, "InvokeEx failed: %08x\n", hres); + /* OnEnterScript was checked in global callback */ + CHECK_CALLED(OnLeaveScript); + CHECK_CALLED(global_globalcallback_i); + + store_script_error = &error1; + + SET_EXPECT(OnEnterScript); + SET_EXPECT(OnLeaveScript); + SET_EXPECT(OnScriptError); + hres = IActiveScriptParse_ParseScriptText(parser, L"err.raise 2\n", + NULL, NULL, NULL, 0, 0, 0, NULL, NULL); + ok(hres == MAKE_VBSERROR(2), "ParseScriptText failed: %08x\n", hres); + CHECK_CALLED(OnEnterScript); + CHECK_CALLED(OnLeaveScript); + CHECK_CALLED(OnScriptError); + + store_script_error = &error2; + + SET_EXPECT(OnEnterScript); + SET_EXPECT(OnLeaveScript); + SET_EXPECT(OnScriptError); + hres = IActiveScriptParse_ParseScriptText(parser, + L"call ok(err.number = 0, \"err.number = \" & err.number)\n" + L"err.raise &h86664004&, \"src\", \"desc\", \"help\", 1\n", + NULL, NULL, NULL, 0, 0, 0, NULL, NULL); + ok(hres == SCRIPT_E_RECORDED, "ParseScriptText failed: %08x\n", hres); + CHECK_CALLED(OnEnterScript); + CHECK_CALLED(OnLeaveScript); + CHECK_CALLED(OnScriptError); + + memset(&ei, 0xcc, sizeof(ei)); + hres = IActiveScriptError_GetExceptionInfo(error1, &ei); + ok(hres == S_OK, "GetExceptionInfo returned %08x\n", hres); + ok(!ei.wCode, "wCode = %x\n", ei.wCode); + ok(!ei.wReserved, "wReserved = %x\n", ei.wReserved); + if(is_english) { + ok(!wcscmp(ei.bstrSource, L"Microsoft VBScript runtime error"), + "bstrSource = %s\n", wine_dbgstr_w(ei.bstrSource)); + ok(!wcscmp(ei.bstrDescription, L"Object doesn't support this property or method"), + "bstrDescription = %s\n", wine_dbgstr_w(ei.bstrDescription)); + } + ok(!ei.bstrHelpFile, "bstrHelpFile = %s\n", wine_dbgstr_w(ei.bstrHelpFile)); + ok(!ei.dwHelpContext, "dwHelpContext = %x\n", ei.dwHelpContext); + ok(!ei.pvReserved, "pvReserved = %p\n", ei.pvReserved); + ok(!ei.pfnDeferredFillIn, "pfnDeferredFillIn = %p\n", ei.pfnDeferredFillIn); + ok(ei.scode == MAKE_VBSERROR(2), "scode = %x\n", ei.scode); + free_ei(&ei); + + IActiveScriptError_Release(error1); + + memset(&ei, 0xcc, sizeof(ei)); + hres = IActiveScriptError_GetExceptionInfo(error2, &ei); + ok(hres == S_OK, "GetExceptionInfo returned %08x\n", hres); + ok(!ei.wCode, "wCode = %x\n", ei.wCode); + ok(!ei.wReserved, "wReserved = %x\n", ei.wReserved); + ok(!wcscmp(ei.bstrSource, L"src"), "bstrSource = %s\n", wine_dbgstr_w(ei.bstrSource)); + ok(!wcscmp(ei.bstrDescription, L"desc"), "bstrDescription = %s\n", wine_dbgstr_w(ei.bstrDescription)); + ok(!wcscmp(ei.bstrHelpFile, L"help"), "bstrHelpFile = %s\n", wine_dbgstr_w(ei.bstrHelpFile)); + ok(ei.dwHelpContext == 1, "dwHelpContext = %x\n", ei.dwHelpContext); + ok(!ei.pvReserved, "pvReserved = %p\n", ei.pvReserved); + ok(!ei.pfnDeferredFillIn, "pfnDeferredFillIn = %p\n", ei.pfnDeferredFillIn); + ok(ei.scode == SCRIPT_E_RECORDED, "scode = %x\n", ei.scode); + free_ei(&ei); + + IActiveScriptError_Release(error2); + + SET_EXPECT(OnEnterScript); + SET_EXPECT(OnLeaveScript); + SET_EXPECT(OnScriptError); + hres = IActiveScriptParse_ParseScriptText(parser, L"err.raise &hffff&\n", + NULL, NULL, NULL, 0, 0, 0, NULL, NULL); + ok(hres == MAKE_VBSERROR(0xffff), "ParseScriptText failed: %08x\n", hres); + CHECK_CALLED(OnEnterScript); + CHECK_CALLED(OnLeaveScript); + CHECK_CALLED(OnScriptError); + + SET_EXPECT(OnEnterScript); + SET_EXPECT(OnLeaveScript); + SET_EXPECT(OnScriptError); + hres = IActiveScriptParse_ParseScriptText(parser, L"err.raise &h80102030&\n", + NULL, NULL, NULL, 0, 0, 0, NULL, NULL); + ok(hres == 0x80102030, "ParseScriptText failed: %08x\n", hres); + CHECK_CALLED(OnEnterScript); + CHECK_CALLED(OnLeaveScript); + CHECK_CALLED(OnScriptError); + + SET_EXPECT(OnEnterScript); + SET_EXPECT(global_testerrorobject_i); + SET_EXPECT(OnLeaveScript); + hres = IActiveScriptParse_ParseScriptText(parser, + L"on error resume next\n" + L"err.raise 1\n" + L"testErrorObject err\n", + NULL, NULL, NULL, 0, 0, 0, NULL, NULL); + ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres); + CHECK_CALLED(OnEnterScript); + CHECK_CALLED(global_testerrorobject_i); + CHECK_CALLED(OnLeaveScript); + + IDispatchEx_Release(dispex); + + IActiveScriptParse_Release(parser); + close_script(script); + strict_enter_script = FALSE; } static void test_gc(void) @@ -1998,6 +2425,62 @@ static void test_gc(void) IActiveScriptParse_Release(parser); } +static void test_parse_errors(void) +{ + static const char *invalid_scripts[] = + { + /* If...End If */ + "If 0 > 1 Then\n" + " x = 0 End If\n", + + /* While...End While */ + "While False\n" + " x = 0 End While\n", + + /* While...Wend */ + "While False\n" + " x = 0 Wend\n", + + /* Do While...Loop */ + "Do While False\n" + " x = 0 Loop\n", + + /* Do Until...Loop */ + "Do Until True\n" + " x = 0 Loop\n", + + /* Do...Loop While */ + "Do\n" + " x = 0 Loop While False\n", + + /* Do...Loop Until */ + "Do\n" + " x = 0 Loop Until True\n", + + /* Select...End Select */ + "x = False\n" + "Select Case 42\n" + " Case 0\n" + " Call ok(False, \"unexpected case\")\n" + " Case 42\n" + " x = True End Select\n" + "Call ok(x, \"wrong case\")\n", + + /* Class...End Class (empty) */ + "Class C End Class" + }; + HRESULT hres; + UINT i; + + for (i = 0; i < ARRAY_SIZE(invalid_scripts); i++) + { + SET_EXPECT(OnScriptError); + hres = parse_script_ar(invalid_scripts[i]); + ok(FAILED(hres), "[%u] script did not fail\n", i); + CHECK_CALLED(OnScriptError); + } +} + static void test_msgbox(void) { HRESULT hres; @@ -2035,7 +2518,7 @@ static void test_msgbox(void) CHECK_CALLED(GetUIBehavior); CHECK_CALLED(GetWindow); CHECK_CALLED(EnableModeless); - todo_wine CHECK_CALLED(OnScriptError); + CHECK_CALLED(OnScriptError); uic_handling = SCRIPTUICHANDLING_NOUIERROR; @@ -2044,7 +2527,7 @@ static void test_msgbox(void) hres = parse_script_ar("MsgBox \"testing...\""); ok(FAILED(hres), "script not failed\n"); CHECK_CALLED(GetUIBehavior); - todo_wine CHECK_CALLED(OnScriptError); + CHECK_CALLED(OnScriptError); } static HRESULT test_global_vars_ref(BOOL use_close) @@ -2104,6 +2587,141 @@ static HRESULT test_global_vars_ref(BOOL use_close) return hres; } +static void test_isexpression(void) +{ + IActiveScriptParse *parser; + IActiveScript *engine; + SCRIPTSTATE ss; + HRESULT hres; + VARIANT var; + BSTR str; + + if (!(engine = create_and_init_script(0, FALSE))) + return; + + hres = IActiveScript_QueryInterface(engine, &IID_IActiveScriptParse, (void**)&parser); + ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres); + if (FAILED(hres)) + { + close_script(engine); + return; + } + + /* Expression when script is not started is still executed */ + hres = IActiveScript_GetScriptState(engine, &ss); + ok(hres == S_OK, "GetScriptState failed: %08x\n", hres); + ok(ss == SCRIPTSTATE_INITIALIZED, "Wrong script state %u\n", ss); + + str = a2bstr("13"); + hres = IActiveScriptParse_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, SCRIPTTEXT_ISEXPRESSION, &var, NULL); + ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres); + ok(V_VT(&var) == VT_I2, "Expected VT_I2, got %s\n", vt2a(&var)); + ok(V_I2(&var) == 13, "Expected 13, got %d\n", V_I2(&var)); + VariantClear(&var); + SysFreeString(str); + + hres = IActiveScript_SetScriptState(engine, SCRIPTSTATE_STARTED); + ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_STARTED) failed: %08x\n", hres); + + /* Empty expressions */ + V_VT(&var) = VT_I2; + str = a2bstr(""); + hres = IActiveScriptParse_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, SCRIPTTEXT_ISEXPRESSION, &var, NULL); + ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres); + ok(V_VT(&var) == VT_EMPTY, "Expected VT_EMPTY, got %s\n", vt2a(&var)); + VariantClear(&var); + SysFreeString(str); + + /* Two expressions fail */ + str = a2bstr("1\n3"); + SET_EXPECT(OnScriptError); + hres = IActiveScriptParse_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, SCRIPTTEXT_ISEXPRESSION, &var, NULL); + ok(FAILED(hres), "ParseScriptText did not fail: %08x\n", hres); + CHECK_CALLED(OnScriptError); + VariantClear(&var); + SysFreeString(str); + + /* Simple numerical expression */ + str = a2bstr("(1 + 7) * 2 - 3"); + hres = IActiveScriptParse_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, SCRIPTTEXT_ISEXPRESSION, NULL, NULL); + ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres); + + hres = IActiveScriptParse_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, SCRIPTTEXT_ISEXPRESSION, &var, NULL); + ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres); + ok(V_VT(&var) == VT_I2, "Expected VT_I2, got %s\n", vt2a(&var)); + ok(V_I2(&var) == 13, "Expected 13, got %d\n", V_I2(&var)); + VariantClear(&var); + SysFreeString(str); + + /* An expression can also refer to a variable, function, class, etc previously set */ + V_VT(&var) = VT_I2; + str = a2bstr("If True Then foo = 42 Else foo = 0\n"); + hres = IActiveScriptParse_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, 0, &var, NULL); + ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres); + ok(V_VT(&var) == VT_EMPTY, "Expected VT_EMPTY, got %s\n", vt2a(&var)); + VariantClear(&var); + SysFreeString(str); + + str = a2bstr("foo\n\n"); + hres = IActiveScriptParse_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, SCRIPTTEXT_ISEXPRESSION, &var, NULL); + ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres); + ok(V_VT(&var) == VT_I2, "Expected VT_I2, got %s\n", vt2a(&var)); + ok(V_I2(&var) == 42, "Expected 42, got %d\n", V_I2(&var)); + VariantClear(&var); + SysFreeString(str); + + str = a2bstr("foo : "); + SET_EXPECT(OnScriptError); + hres = IActiveScriptParse_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, SCRIPTTEXT_ISEXPRESSION, &var, NULL); + ok(FAILED(hres), "ParseScriptText did not fail: %08x\n", hres); + CHECK_CALLED(OnScriptError); + VariantClear(&var); + SysFreeString(str); + + str = a2bstr("\"foo is \" & CStr(foo) \n \n\n "); + hres = IActiveScriptParse_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, SCRIPTTEXT_ISEXPRESSION, &var, NULL); + ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres); + ok(V_VT(&var) == VT_BSTR, "Expected VT_BSTR, got %s\n", vt2a(&var)); + ok(!strcmp_wa(V_BSTR(&var), "foo is 42"), "Wrong string, got %s\n", wine_dbgstr_w(V_BSTR(&var))); + VariantClear(&var); + SysFreeString(str); + + str = a2bstr("Function test(x)\n" + " test = x + 0.5\n" + "End Function\n"); + hres = IActiveScriptParse_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL); + ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres); + SysFreeString(str); + + str = a2bstr("test(4) * 3\n"); + hres = IActiveScriptParse_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, SCRIPTTEXT_ISEXPRESSION, &var, NULL); + ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres); + ok(V_VT(&var) == VT_R8, "Expected VT_R8, got %s\n", vt2a(&var)); + ok(V_R8(&var) == 13.5, "Expected %lf, got %lf\n", 13.5, V_R8(&var)); + VariantClear(&var); + SysFreeString(str); + + str = a2bstr("Class C\n" + " Public x\n" + "End Class\n" + "Set obj = New C\n" + "obj.x = True\n"); + hres = IActiveScriptParse_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL); + ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres); + SysFreeString(str); + + str = a2bstr("obj.x"); + hres = IActiveScriptParse_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, SCRIPTTEXT_ISEXPRESSION, &var, NULL); + ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres); + ok(V_VT(&var) == VT_BOOL, "Expected VT_BOOL, got %s\n", vt2a(&var)); + ok(V_BOOL(&var) == VARIANT_TRUE, "Expected %x, got %x\n", VARIANT_TRUE, V_BOOL(&var)); + VariantClear(&var); + SysFreeString(str); + + IActiveScriptParse_Release(parser); + close_script(engine); +} + static BSTR get_script_from_file(const char *filename) { DWORD size, len; @@ -2186,6 +2804,7 @@ static void run_from_res(const char *name) ok(hres == S_OK, "parse_script failed: %08x\n", hres); SysFreeString(str); + test_name = ""; } static void run_tests(void) @@ -2255,6 +2874,13 @@ static void run_tests(void) parse_script_a("Option Explicit\nset test.setobj = testObj"); CHECK_CALLED(global_setobj_i); + SET_EXPECT(OnScriptError); + hres = parse_script_ar("dim x\nx = testObj.rem"); + todo_wine + ok(hres == S_OK, "use of 'rem' as dot identifier failed: %x08\n", hres); + todo_wine + CHECK_NOT_CALLED(OnScriptError); + SET_EXPECT(testobj_propget_d); SET_EXPECT(testobj_propget_i); parse_script_a("dim x\nx = testObj.propget"); @@ -2299,7 +2925,7 @@ static void run_tests(void) SET_EXPECT(OnScriptError); hres = parse_script_ar("<!--"); ok(FAILED(hres), "script didn't fail\n"); - todo_wine CHECK_CALLED(OnScriptError); + CHECK_CALLED(OnScriptError); SET_EXPECT(global_success_d); SET_EXPECT(global_success_i); @@ -2325,36 +2951,36 @@ static void run_tests(void) SET_EXPECT(OnScriptError); hres = parse_script_ar("throwInt(&h80080008&)"); ok(hres == 0x80080008, "hres = %08x\n", hres); - todo_wine CHECK_CALLED(OnScriptError); + CHECK_CALLED(OnScriptError); /* DISP_E_BADINDEX */ SET_EXPECT(OnScriptError); hres = parse_script_ar("throwInt(&h8002000b&)"); ok(hres == MAKE_VBSERROR(9), "hres = %08x\n", hres); - todo_wine CHECK_CALLED(OnScriptError); + CHECK_CALLED(OnScriptError); SET_EXPECT(OnScriptError); hres = parse_script_ar("throwInt(&h800a0009&)"); ok(hres == MAKE_VBSERROR(9), "hres = %08x\n", hres); - todo_wine CHECK_CALLED(OnScriptError); + CHECK_CALLED(OnScriptError); onerror_hres = S_OK; SET_EXPECT(OnScriptError); hres = parse_script_ar("throwInt(&h800a0009&)"); - todo_wine ok(hres == SCRIPT_E_REPORTED, "hres = %08x\n", hres); - todo_wine CHECK_CALLED(OnScriptError); + ok(hres == SCRIPT_E_REPORTED, "hres = %08x\n", hres); + CHECK_CALLED(OnScriptError); /* E_NOTIMPL */ SET_EXPECT(OnScriptError); hres = parse_script_ar("throwInt(&h80004001&)"); ok(hres == MAKE_VBSERROR(445), "hres = %08x\n", hres); - todo_wine CHECK_CALLED(OnScriptError); + CHECK_CALLED(OnScriptError); onerror_hres = S_OK; SET_EXPECT(OnScriptError); hres = parse_script_ar("throwInt(&h80004001&)"); - todo_wine ok(hres == SCRIPT_E_REPORTED, "hres = %08x\n", hres); - todo_wine CHECK_CALLED(OnScriptError); + ok(hres == SCRIPT_E_REPORTED, "hres = %08x\n", hres); + CHECK_CALLED(OnScriptError); SET_EXPECT(global_testoptionalarg_i); parse_script_a("call testOptionalArg(1,,2)"); @@ -2392,11 +3018,14 @@ static void run_tests(void) SET_EXPECT(OnScriptError); hres = parse_script_ar("x = y(\"a\")"); ok(FAILED(hres), "script didn't fail\n"); - todo_wine CHECK_CALLED(OnScriptError); + CHECK_CALLED(OnScriptError); SET_EXPECT(global_success_d); SET_EXPECT(global_success_i); parse_script_a("' comment\r" + "x = _\r3\r" + "x = _\n3\r" + "x = _\r\n3\r" "Sub testsub(arg)\r" "If arg = 1 Then\r\r" "Call reportSuccess()\n\n" @@ -2414,7 +3043,10 @@ static void run_tests(void) test_procedures(); test_gc(); test_msgbox(); + test_isexpression(); + test_parse_errors(); test_parse_context(); + test_callbacks(); } static BOOL check_vbscript(void) diff --git a/modules/rostests/winetests/vbscript/vbscript.c b/modules/rostests/winetests/vbscript/vbscript.c index 9e86a5f9198..08edfc1be79 100644 --- a/modules/rostests/winetests/vbscript/vbscript.c +++ b/modules/rostests/winetests/vbscript/vbscript.c @@ -84,6 +84,9 @@ DEFINE_EXPECT(OnStateChange_CLOSED); DEFINE_EXPECT(OnStateChange_INITIALIZED); DEFINE_EXPECT(OnEnterScript); DEFINE_EXPECT(OnLeaveScript); +DEFINE_EXPECT(GetItemInfo_global); +DEFINE_EXPECT(GetItemInfo_visible); +DEFINE_EXPECT(testCall); DEFINE_GUID(CLSID_VBScript, 0xb54f3741, 0x5b07, 0x11cf, 0xa4,0xb0, 0x00,0xaa,0x00,0x4a,0x55,0xe8); DEFINE_GUID(CLSID_VBScriptRegExp, 0x3f4daca4, 0x160d, 0x11d2, 0xa8,0xe9, 0x00,0x10,0x4b,0x36,0x5c,0x9f); @@ -111,6 +114,95 @@ static void _test_state(unsigned line, IActiveScript *script, SCRIPTSTATE exstat ok_(__FILE__,line) (state == exstate, "state=%d, expected %d\n", state, exstate); } +static HRESULT WINAPI Dispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv) +{ + if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IDispatch, riid)) { + *ppv = iface; + IDispatch_AddRef(iface); + return S_OK; + } + + *ppv = NULL; + return E_NOINTERFACE; +} + +static ULONG global_named_item_ref, visible_named_item_ref; + +static ULONG WINAPI global_AddRef(IDispatch *iface) +{ + return ++global_named_item_ref; +} + +static ULONG WINAPI global_Release(IDispatch *iface) +{ + return --global_named_item_ref; +} + +static ULONG WINAPI visible_AddRef(IDispatch *iface) +{ + return ++visible_named_item_ref; +} + +static ULONG WINAPI visible_Release(IDispatch *iface) +{ + return --visible_named_item_ref; +} + +static HRESULT WINAPI Dispatch_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI Dispatch_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) +{ + return DISP_E_BADINDEX; +} + +static HRESULT WINAPI Dispatch_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *names, UINT name_cnt, + LCID lcid, DISPID *ids) +{ + ok(name_cnt == 1, "name_cnt = %u\n", name_cnt); + ok(!wcscmp(names[0], L"testCall"), "names[0] = %s\n", wine_dbgstr_w(names[0])); + *ids = 1; + return S_OK; +} + +static HRESULT WINAPI Dispatch_Invoke(IDispatch *iface, DISPID id, REFIID riid, LCID lcid, WORD flags, + DISPPARAMS *dp, VARIANT *res, EXCEPINFO *ei, UINT *err) +{ + CHECK_EXPECT(testCall); + ok(id == 1, "id = %u\n", id); + ok(flags == DISPATCH_METHOD, "flags = %x\n", flags); + ok(!dp->cArgs, "cArgs = %u\n", dp->cArgs); + ok(!res, "res = %p\n", res); + return S_OK; +} + +static const IDispatchVtbl global_named_item_vtbl = { + Dispatch_QueryInterface, + global_AddRef, + global_Release, + Dispatch_GetTypeInfoCount, + Dispatch_GetTypeInfo, + Dispatch_GetIDsOfNames, + Dispatch_Invoke +}; + +static IDispatch global_named_item = { &global_named_item_vtbl }; + +static const IDispatchVtbl visible_named_item_vtbl = { + Dispatch_QueryInterface, + visible_AddRef, + visible_Release, + Dispatch_GetTypeInfoCount, + Dispatch_GetTypeInfo, + Dispatch_GetIDsOfNames, + Dispatch_Invoke +}; + +static IDispatch visible_named_item = { &visible_named_item_vtbl }; + static HRESULT WINAPI ActiveScriptSite_QueryInterface(IActiveScriptSite *iface, REFIID riid, void **ppv) { *ppv = NULL; @@ -142,10 +234,23 @@ static HRESULT WINAPI ActiveScriptSite_GetLCID(IActiveScriptSite *iface, LCID *p return E_NOTIMPL; } -static HRESULT WINAPI ActiveScriptSite_GetItemInfo(IActiveScriptSite *iface, LPCOLESTR pstrName, - DWORD dwReturnMask, IUnknown **ppiunkItem, ITypeInfo **ppti) +static HRESULT WINAPI ActiveScriptSite_GetItemInfo(IActiveScriptSite *iface, LPCOLESTR name, + DWORD return_mask, IUnknown **item_unk, ITypeInfo **item_ti) { - ok(0, "unexpected call\n"); + ok(return_mask == SCRIPTINFO_IUNKNOWN, "return_mask = %x\n", return_mask); + if(!wcscmp(name, L"globalItem")) { + CHECK_EXPECT(GetItemInfo_global); + IDispatch_AddRef(&global_named_item); + *item_unk = (IUnknown*)&global_named_item; + return S_OK; + } + if(!wcscmp(name, L"visibleItem")) { + CHECK_EXPECT(GetItemInfo_visible); + IDispatch_AddRef(&visible_named_item); + *item_unk = (IUnknown*)&visible_named_item; + return S_OK; + } + ok(0, "unexpected call %s\n", wine_dbgstr_w(name)); return E_NOTIMPL; } @@ -392,8 +497,8 @@ static IActiveScript *create_vbscript(void) static void test_scriptdisp(void) { + IDispatchEx *script_disp, *script_disp2; IActiveScriptParse *parser; - IDispatchEx *script_disp; IActiveScript *vbscript; DISPID id, id2; DISPPARAMS dp; @@ -415,6 +520,8 @@ static void test_scriptdisp(void) ok(hres == S_OK, "SetScriptSite failed: %08x\n", hres); CHECK_CALLED(GetLCID); + script_disp2 = get_script_dispatch(vbscript); + test_state(vbscript, SCRIPTSTATE_UNINITIALIZED); SET_EXPECT(OnStateChange_INITIALIZED); @@ -432,6 +539,8 @@ static void test_scriptdisp(void) test_state(vbscript, SCRIPTSTATE_CONNECTED); script_disp = get_script_dispatch(vbscript); + ok(script_disp == script_disp2, "script_disp != script_disp2\n"); + IDispatchEx_Release(script_disp2); id = 100; get_disp_id(script_disp, "LCase", DISP_E_UNKNOWNNAME, &id); @@ -529,6 +638,7 @@ static void test_vbscript(void) test_state(vbscript, SCRIPTSTATE_UNINITIALIZED); test_safety(vbscript); + test_no_script_dispatch(vbscript); SET_EXPECT(GetLCID); hres = IActiveScript_SetScriptSite(vbscript, &ActiveScriptSite); @@ -600,6 +710,8 @@ static void test_vbscript_uninitializing(void) hres = IActiveScriptParse_InitNew(parse); ok(hres == S_OK, "InitNew failed: %08x\n", hres); + test_no_script_dispatch(script); + SET_EXPECT(GetLCID); SET_EXPECT(OnStateChange_INITIALIZED); hres = IActiveScript_SetScriptSite(script, &ActiveScriptSite); @@ -685,6 +797,9 @@ static void test_vbscript_uninitializing(void) test_state(script, SCRIPTSTATE_CLOSED); + hres = IActiveScriptParse_InitNew(parse); + ok(hres == E_UNEXPECTED, "InitNew failed: %08x\n", hres); + IActiveScriptParse_Release(parse); ref = IActiveScript_Release(script); @@ -794,6 +909,88 @@ static void test_vbscript_initializing(void) ok(!ref, "ref = %d\n", ref); } +static void test_named_items(void) +{ + IActiveScriptParse *parse; + IActiveScript *script; + ULONG ref; + HRESULT hres; + + script = create_vbscript(); + + hres = IActiveScript_QueryInterface(script, &IID_IActiveScriptParse, (void**)&parse); + ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres); + + test_state(script, SCRIPTSTATE_UNINITIALIZED); + + hres = IActiveScript_AddNamedItem(script, L"visibleItem", SCRIPTITEM_ISVISIBLE); + ok(hres == E_UNEXPECTED, "AddNamedItem returned: %08x\n", hres); + hres = IActiveScript_AddNamedItem(script, L"globalItem", SCRIPTITEM_GLOBALMEMBERS); + ok(hres == E_UNEXPECTED, "AddNamedItem returned: %08x\n", hres); + + SET_EXPECT(GetLCID); + hres = IActiveScript_SetScriptSite(script, &ActiveScriptSite); + ok(hres == S_OK, "SetScriptSite failed: %08x\n", hres); + CHECK_CALLED(GetLCID); + + SET_EXPECT(GetItemInfo_global); + hres = IActiveScript_AddNamedItem(script, L"globalItem", SCRIPTITEM_GLOBALMEMBERS); + ok(hres == S_OK, "AddNamedItem failed: %08x\n", hres); + CHECK_CALLED(GetItemInfo_global); + + hres = IActiveScript_AddNamedItem(script, L"visibleItem", SCRIPTITEM_ISVISIBLE); + ok(hres == S_OK, "AddNamedItem failed: %08x\n", hres); + + ok(global_named_item_ref > 0, "global_named_item_ref = %u\n", global_named_item_ref); + ok(visible_named_item_ref == 0, "visible_named_item_ref = %u\n", visible_named_item_ref); + + SET_EXPECT(OnStateChange_INITIALIZED); + hres = IActiveScriptParse_InitNew(parse); + ok(hres == S_OK, "InitNew failed: %08x\n", hres); + CHECK_CALLED(OnStateChange_INITIALIZED); + + SET_EXPECT(OnStateChange_CONNECTED); + hres = IActiveScript_SetScriptState(script, SCRIPTSTATE_CONNECTED); + ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_CONNECTED) failed: %08x\n", hres); + CHECK_CALLED(OnStateChange_CONNECTED); + + SET_EXPECT(testCall); + parse_script(parse, "testCall\n"); + CHECK_CALLED(testCall); + + SET_EXPECT(GetItemInfo_visible); + SET_EXPECT(testCall); + parse_script(parse, "visibleItem.testCall\n"); + CHECK_CALLED(GetItemInfo_visible); + CHECK_CALLED(testCall); + + ok(global_named_item_ref > 0, "global_named_item_ref = %u\n", global_named_item_ref); + ok(visible_named_item_ref == 1, "visible_named_item_ref = %u\n", visible_named_item_ref); + + SET_EXPECT(testCall); + parse_script(parse, "visibleItem.testCall\n"); + CHECK_CALLED(testCall); + + SET_EXPECT(OnStateChange_DISCONNECTED); + SET_EXPECT(OnStateChange_INITIALIZED); + SET_EXPECT(OnStateChange_CLOSED); + hres = IActiveScript_Close(script); + ok(hres == S_OK, "Close failed: %08x\n", hres); + CHECK_CALLED(OnStateChange_DISCONNECTED); + CHECK_CALLED(OnStateChange_INITIALIZED); + CHECK_CALLED(OnStateChange_CLOSED); + + ok(global_named_item_ref == 0, "global_named_item_ref = %u\n", global_named_item_ref); + ok(visible_named_item_ref == 0, "visible_named_item_ref = %u\n", visible_named_item_ref); + + test_state(script, SCRIPTSTATE_CLOSED); + + IActiveScriptParse_Release(parse); + + ref = IActiveScript_Release(script); + ok(!ref, "ref = %d\n", ref); +} + static void test_RegExp(void) { IRegExp2 *regexp; @@ -957,6 +1154,7 @@ START_TEST(vbscript) test_vbscript_release(); test_vbscript_simplecreate(); test_vbscript_initializing(); + test_named_items(); test_scriptdisp(); test_RegExp(); }else {
1
0
0
0
[reactos] 01/01: [PSDK] Update activscp.idl. CORE-16441
by Amine Khaldi
01 Dec '19
01 Dec '19
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=285df607d2315f23882bd…
commit 285df607d2315f23882bd464d7c0e21c7a3967d9 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sun Dec 1 19:42:38 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Dec 1 19:42:38 2019 +0100 [PSDK] Update activscp.idl. CORE-16441 --- sdk/include/psdk/activscp.idl | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/sdk/include/psdk/activscp.idl b/sdk/include/psdk/activscp.idl index 8a3d75d5b52..f70db4a7431 100644 --- a/sdk/include/psdk/activscp.idl +++ b/sdk/include/psdk/activscp.idl @@ -45,7 +45,14 @@ cpp_quote("#define SCRIPTPROP_INVOKEVERSIONING 0x00004000") cpp_quote("#define SCRIPTPROP_HACK_FIBERSUPPORT 0x70000000") cpp_quote("#define SCRIPTPROP_HACK_TRIDENTEVENTSINK 0x70000001") cpp_quote("#define SCRIPTPROP_ABBREVIATE_GLOBALNAME_RESOLUTION 0x70000002") - + +typedef enum tagSCRIPTLANGUAGEVERSION { + SCRIPTLANGUAGEVERSION_DEFAULT = 0, + SCRIPTLANGUAGEVERSION_5_7 = 1, + SCRIPTLANGUAGEVERSION_5_8 = 2, + SCRIPTLANGUAGEVERSION_MAX = 255 +} SCRIPTLANGUAGEVERSION; + typedef enum tagSCRIPTSTATE { SCRIPTSTATE_UNINITIALIZED = 0, SCRIPTSTATE_STARTED = 1, @@ -71,6 +78,11 @@ typedef enum tagSCRIPTUICHANDLING { SCRIPTUICHANDLING_NOUIDEFAULT = 2 } SCRIPTUICHANDLING; +typedef enum tagSCRIPTGCTYPE { + SCRIPTGCTYPE_NORMAL = 0, + SCRIPTGCTYPE_EXHAUSTIVE = 1 +} SCRIPTGCTYPE; + typedef DWORD SCRIPTTHREADID; cpp_quote("#define SCRIPTTHREADID_CURRENT ((SCRIPTTHREADID)-1)") cpp_quote("#define SCRIPTTHREADID_BASE ((SCRIPTTHREADID)-2)") @@ -101,6 +113,7 @@ cpp_quote(" SCRIPTTEXT_ISVISIBLE | \\") cpp_quote(" SCRIPTTEXT_ISEXPRESSION | \\") cpp_quote(" SCRIPTTEXT_ISPERSISTENT | \\") cpp_quote(" SCRIPTTEXT_HOSTMANAGESSOURCE)") +cpp_quote("#define SCRIPTPROC_ISEXPRESSION 0x00000020") cpp_quote("#define SCRIPTPROC_HOSTMANAGESSOURCE 0x00000080") cpp_quote("#define SCRIPTPROC_IMPLICIT_THIS 0x00000100") cpp_quote("#define SCRIPTPROC_IMPLICIT_PARENTS 0x00000200") @@ -551,3 +564,14 @@ interface IActiveScriptProperty : IUnknown [in] VARIANT *pvarIndex, [in] VARIANT *pvarValue); } + +[ + object, + uuid(6aa2c4a0-2b53-11d4-a2a0-00104bd35090), + pointer_default(unique) +] +interface IActiveScriptGarbageCollector : IUnknown +{ + HRESULT CollectGarbage( + [in] SCRIPTGCTYPE gctype); +}
1
0
0
0
[reactos] 01/01: [VBSCRIPT] Sync with Wine Staging 4.18. CORE-16441
by Amine Khaldi
01 Dec '19
01 Dec '19
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9a0ddc1388bb296ea8c7b…
commit 9a0ddc1388bb296ea8c7b97057b44428ad3b843e Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sun Dec 1 19:42:07 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Dec 1 19:42:07 2019 +0100 [VBSCRIPT] Sync with Wine Staging 4.18. CORE-16441 --- dll/win32/vbscript/compile.c | 108 +- dll/win32/vbscript/global.c | 1168 ++++++++++------ dll/win32/vbscript/interp.c | 138 +- dll/win32/vbscript/lex.c | 66 +- dll/win32/vbscript/parse.h | 13 +- dll/win32/vbscript/parser.tab.c | 2600 +++++++++++++++++++++--------------- dll/win32/vbscript/parser.tab.h | 149 ++- dll/win32/vbscript/parser.y | 169 ++- dll/win32/vbscript/regexp.c | 28 +- dll/win32/vbscript/vbdisp.c | 288 ++-- dll/win32/vbscript/vbregexp.c | 4 +- dll/win32/vbscript/vbscript.c | 281 ++-- dll/win32/vbscript/vbscript.h | 111 +- dll/win32/vbscript/vbscript.rc | 42 + dll/win32/vbscript/vbscript_defs.h | 37 + dll/win32/vbscript/vbscript_main.c | 64 +- media/doc/README.WINE | 2 +- 17 files changed, 3165 insertions(+), 2103 deletions(-) diff --git a/dll/win32/vbscript/compile.c b/dll/win32/vbscript/compile.c index 302804f4c28..c129f3670da 100644 --- a/dll/win32/vbscript/compile.c +++ b/dll/win32/vbscript/compile.c @@ -136,7 +136,7 @@ static WCHAR *compiler_alloc_string(vbscode_t *vbscode, const WCHAR *str) size_t size; WCHAR *ret; - size = (strlenW(str)+1)*sizeof(WCHAR); + size = (lstrlenW(str)+1)*sizeof(WCHAR); ret = compiler_alloc(vbscode, size); if(ret) memcpy(ret, str, size); @@ -375,12 +375,24 @@ static inline BOOL emit_catch(compile_ctx_t *ctx, unsigned off) return emit_catch_jmp(ctx, off, ctx->instr_cnt); } +static HRESULT compile_error(script_ctx_t *ctx, HRESULT error) +{ + if(error == SCRIPT_E_REPORTED) + return error; + + clear_ei(&ctx->ei); + ctx->ei.scode = error = map_hres(error); + ctx->ei.bstrSource = get_vbscript_string(VBS_COMPILE_ERROR); + ctx->ei.bstrDescription = get_vbscript_error_string(error); + return report_script_error(ctx); +} + static expression_t *lookup_const_decls(compile_ctx_t *ctx, const WCHAR *name, BOOL lookup_global) { const_decl_t *decl; for(decl = ctx->const_decls; decl; decl = decl->next) { - if(!strcmpiW(decl->name, name)) + if(!wcsicmp(decl->name, name)) return decl->value_expr; } @@ -388,7 +400,7 @@ static expression_t *lookup_const_decls(compile_ctx_t *ctx, const WCHAR *name, B return NULL; for(decl = ctx->global_consts; decl; decl = decl->next) { - if(!strcmpiW(decl->name, name)) + if(!wcsicmp(decl->name, name)) return decl->value_expr; } @@ -536,10 +548,8 @@ static HRESULT compile_expression(compile_ctx_t *ctx, expression_t *expr) return push_instr_str(ctx, OP_string, ((string_expression_t*)expr)->value); case EXPR_SUB: return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_sub); - case EXPR_USHORT: - return push_instr_int(ctx, OP_short, ((int_expression_t*)expr)->value); - case EXPR_ULONG: - return push_instr_int(ctx, OP_long, ((int_expression_t*)expr)->value); + case EXPR_INT: + return push_instr_int(ctx, OP_int, ((int_expression_t*)expr)->value); case EXPR_XOR: return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_xor); default: @@ -781,7 +791,7 @@ static HRESULT compile_forto_statement(compile_ctx_t *ctx, forto_statement_t *st if(!push_instr(ctx, OP_val)) return E_OUTOFMEMORY; }else { - hres = push_instr_int(ctx, OP_short, 1); + hres = push_instr_int(ctx, OP_int, 1); if(FAILED(hres)) return hres; } @@ -994,7 +1004,7 @@ static BOOL lookup_dim_decls(compile_ctx_t *ctx, const WCHAR *name) dim_decl_t *dim_decl; for(dim_decl = ctx->dim_decls; dim_decl; dim_decl = dim_decl->next) { - if(!strcmpiW(dim_decl->name, name)) + if(!wcsicmp(dim_decl->name, name)) return TRUE; } @@ -1006,7 +1016,7 @@ static BOOL lookup_args_name(compile_ctx_t *ctx, const WCHAR *name) unsigned i; for(i = 0; i < ctx->func->arg_cnt; i++) { - if(!strcmpiW(ctx->func->args[i].name, name)) + if(!wcsicmp(ctx->func->args[i].name, name)) return TRUE; } @@ -1198,6 +1208,21 @@ static HRESULT compile_onerror_statement(compile_ctx_t *ctx, onerror_statement_t return push_instr_int(ctx, OP_errmode, stat->resume_next); } +static HRESULT compile_retval_statement(compile_ctx_t *ctx, retval_statement_t *stat) +{ + HRESULT hres; + + hres = compile_expression(ctx, stat->expr); + if(FAILED(hres)) + return hres; + + hres = push_instr(ctx, OP_retval); + if(FAILED(hres)) + return hres; + + return S_OK; +} + static HRESULT compile_statement(compile_ctx_t *ctx, statement_ctx_t *stat_ctx, statement_t *stat) { HRESULT hres; @@ -1269,6 +1294,9 @@ static HRESULT compile_statement(compile_ctx_t *ctx, statement_ctx_t *stat_ctx, case STAT_WHILELOOP: hres = compile_while_statement(ctx, (while_statement_t*)stat); break; + case STAT_RETVAL: + hres = compile_retval_statement(ctx, (retval_statement_t*)stat); + break; default: FIXME("Unimplemented statement type %d\n", stat->type); hres = E_NOTIMPL; @@ -1444,7 +1472,7 @@ static BOOL lookup_funcs_name(compile_ctx_t *ctx, const WCHAR *name) function_t *iter; for(iter = ctx->funcs; iter; iter = iter->next) { - if(!strcmpiW(iter->name, name)) + if(!wcsicmp(iter->name, name)) return TRUE; } @@ -1511,7 +1539,7 @@ static BOOL lookup_class_name(compile_ctx_t *ctx, const WCHAR *name) class_desc_t *iter; for(iter = ctx->classes; iter; iter = iter->next) { - if(!strcmpiW(iter->name, name)) + if(!wcsicmp(iter->name, name)) return TRUE; } @@ -1563,7 +1591,7 @@ static BOOL lookup_class_funcs(class_desc_t *class_desc, const WCHAR *name) unsigned i; for(i=0; i < class_desc->func_cnt; i++) { - if(class_desc->funcs[i].name && !strcmpiW(class_desc->funcs[i].name, name)) + if(class_desc->funcs[i].name && !wcsicmp(class_desc->funcs[i].name, name)) return TRUE; } @@ -1619,14 +1647,14 @@ static HRESULT compile_class(compile_ctx_t *ctx, class_decl_t *class_decl) } } - if(!strcmpiW(class_initializeW, func_decl->name)) { + if(!wcsicmp(class_initializeW, func_decl->name)) { if(func_decl->type != FUNC_SUB) { FIXME("class initializer is not sub\n"); return E_FAIL; } class_desc->class_initialize_id = i; - }else if(!strcmpiW(class_terminateW, func_decl->name)) { + }else if(!wcsicmp(class_terminateW, func_decl->name)) { if(func_decl->type != FUNC_SUB) { FIXME("class terminator is not sub\n"); return E_FAIL; @@ -1690,17 +1718,17 @@ static BOOL lookup_script_identifier(script_ctx_t *script, const WCHAR *identifi function_t *func; for(var = script->global_vars; var; var = var->next) { - if(!strcmpiW(var->name, identifier)) + if(!wcsicmp(var->name, identifier)) return TRUE; } for(func = script->global_funcs; func; func = func->next) { - if(!strcmpiW(func->name, identifier)) + if(!wcsicmp(func->name, identifier)) return TRUE; } for(class = script->classes; class; class = class->next) { - if(!strcmpiW(class->name, identifier)) + if(!wcsicmp(class->name, identifier)) return TRUE; } @@ -1797,7 +1825,7 @@ static void release_compiler(compile_ctx_t *ctx) release_vbscode(ctx->code); } -HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *delimiter, vbscode_t **ret) +HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *delimiter, DWORD flags, vbscode_t **ret) { function_t *new_func; function_decl_t *func_decl; @@ -1806,13 +1834,15 @@ HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *deli vbscode_t *code; HRESULT hres; - hres = parse_script(&ctx.parser, src, delimiter); + if (!src) src = L""; + + hres = parse_script(&ctx.parser, src, delimiter, flags); if(FAILED(hres)) - return hres; + return compile_error(script, hres); code = ctx.code = alloc_vbscode(&ctx, src); if(!ctx.code) - return E_OUTOFMEMORY; + return compile_error(script, E_OUTOFMEMORY); ctx.funcs = NULL; ctx.func_decls = NULL; @@ -1826,7 +1856,7 @@ HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *deli hres = compile_func(&ctx, ctx.parser.stats, &ctx.code->main_code); if(FAILED(hres)) { release_compiler(&ctx); - return hres; + return compile_error(script, hres); } ctx.global_consts = ctx.const_decls; @@ -1835,7 +1865,7 @@ HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *deli hres = create_function(&ctx, func_decl, &new_func); if(FAILED(hres)) { release_compiler(&ctx); - return hres; + return compile_error(script, hres); } new_func->next = ctx.funcs; @@ -1846,14 +1876,14 @@ HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *deli hres = compile_class(&ctx, class_decl); if(FAILED(hres)) { release_compiler(&ctx); - return hres; + return compile_error(script, hres); } } hres = check_script_collisions(&ctx, script); if(FAILED(hres)) { release_compiler(&ctx); - return hres; + return compile_error(script, hres); } if(ctx.global_vars) { @@ -1896,3 +1926,29 @@ HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *deli *ret = code; return S_OK; } + +HRESULT compile_procedure(script_ctx_t *script, const WCHAR *src, const WCHAR *delimiter, DWORD flags, class_desc_t **ret) +{ + class_desc_t *desc; + vbscode_t *code; + HRESULT hres; + + hres = compile_script(script, src, delimiter, flags, &code); + if(FAILED(hres)) + return hres; + + if(!(desc = compiler_alloc_zero(code, sizeof(*desc)))) + return E_OUTOFMEMORY; + if(!(desc->funcs = compiler_alloc_zero(code, sizeof(*desc->funcs)))) + return E_OUTOFMEMORY; + + desc->ctx = script; + desc->func_cnt = 1; + desc->funcs->entries[VBDISP_CALLGET] = &code->main_code; + + desc->next = script->procs; + script->procs = desc; + + *ret = desc; + return S_OK; +} diff --git a/dll/win32/vbscript/global.c b/dll/win32/vbscript/global.c index 6d26b2c6a5c..db1f4c74405 100644 --- a/dll/win32/vbscript/global.c +++ b/dll/win32/vbscript/global.c @@ -29,6 +29,7 @@ #ifdef __REACTOS__ #include <wingdi.h> +#include <winnls.h> #endif WINE_DEFAULT_DEBUG_CHANNEL(vbscript); @@ -43,6 +44,252 @@ const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY = static const WCHAR emptyW[] = {0}; static const WCHAR vbscriptW[] = {'V','B','S','c','r','i','p','t',0}; +#define BP_GET 1 +#define BP_GETPUT 2 + +typedef struct { + UINT16 len; + WCHAR buf[7]; +} string_constant_t; + +struct _builtin_prop_t { + const WCHAR *name; + HRESULT (*proc)(BuiltinDisp*,VARIANT*,unsigned,VARIANT*); + DWORD flags; + unsigned min_args; + UINT_PTR max_args; +}; + +static inline BuiltinDisp *impl_from_IDispatch(IDispatch *iface) +{ + return CONTAINING_RECORD(iface, BuiltinDisp, IDispatch_iface); +} + +static HRESULT WINAPI Builtin_QueryInterface(IDispatch *iface, REFIID riid, void **ppv) +{ + BuiltinDisp *This = impl_from_IDispatch(iface); + + if(IsEqualGUID(&IID_IUnknown, riid)) { + TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); + *ppv = &This->IDispatch_iface; + }else if(IsEqualGUID(&IID_IDispatch, riid)) { + TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv); + *ppv = &This->IDispatch_iface; + }else { + WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv); + *ppv = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; +} + +static ULONG WINAPI Builtin_AddRef(IDispatch *iface) +{ + BuiltinDisp *This = impl_from_IDispatch(iface); + LONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + return ref; +} + +static ULONG WINAPI Builtin_Release(IDispatch *iface) +{ + BuiltinDisp *This = impl_from_IDispatch(iface); + LONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + if(!ref) { + assert(!This->ctx); + heap_free(This); + } + + return ref; +} + +static HRESULT WINAPI Builtin_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo) +{ + BuiltinDisp *This = impl_from_IDispatch(iface); + TRACE("(%p)->(%p)\n", This, pctinfo); + *pctinfo = 0; + return S_OK; +} + +static HRESULT WINAPI Builtin_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) +{ + BuiltinDisp *This = impl_from_IDispatch(iface); + TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); + return DISP_E_BADINDEX; +} + +HRESULT get_builtin_id(BuiltinDisp *disp, const WCHAR *name, DISPID *id) +{ + size_t min = 1, max = disp->member_cnt - 1, i; + int r; + + while(min <= max) { + i = (min + max) / 2; + r = wcsicmp(disp->members[i].name, name); + if(!r) { + *id = i; + return S_OK; + } + if(r < 0) + min = i+1; + else + max = i-1; + } + + return DISP_E_MEMBERNOTFOUND; + +} + +static HRESULT WINAPI Builtin_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *names, UINT name_cnt, + LCID lcid, DISPID *ids) +{ + BuiltinDisp *This = impl_from_IDispatch(iface); + unsigned i; + HRESULT hres; + + TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), names, name_cnt, lcid, ids); + + if(!This->ctx) { + FIXME("NULL context\n"); + return E_UNEXPECTED; + } + + for(i = 0; i < name_cnt; i++) { + hres = get_builtin_id(This, names[i], &ids[i]); + if(FAILED(hres)) + return hres; + } + + return S_OK; +} + +static HRESULT WINAPI Builtin_Invoke(IDispatch *iface, DISPID id, REFIID riid, LCID lcid, WORD flags, + DISPPARAMS *dp, VARIANT *res, EXCEPINFO *ei, UINT *err) +{ + BuiltinDisp *This = impl_from_IDispatch(iface); + const builtin_prop_t *prop; + VARIANT args[8]; + unsigned argn, i; + + TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, id, debugstr_guid(riid), lcid, flags, dp, res, ei, err); + + if(!This->ctx) { + FIXME("NULL context\n"); + return E_UNEXPECTED; + } + + if(id >= This->member_cnt || (!This->members[id].proc && !This->members[id].flags)) + return DISP_E_MEMBERNOTFOUND; + prop = This->members + id; + + switch(flags) { + case DISPATCH_PROPERTYGET: + if(!(prop->flags & (BP_GET|BP_GETPUT))) { + FIXME("property does not support DISPATCH_PROPERTYGET\n"); + return E_FAIL; + } + break; + case DISPATCH_PROPERTYGET|DISPATCH_METHOD: + if(!prop->proc && prop->flags == BP_GET) { + const int vt = prop->min_args, val = prop->max_args; + switch(vt) { + case VT_I2: + V_VT(res) = VT_I2; + V_I2(res) = val; + break; + case VT_I4: + V_VT(res) = VT_I4; + V_I4(res) = val; + break; + case VT_BSTR: { + const string_constant_t *str = (const string_constant_t*)prop->max_args; + BSTR ret; + + ret = SysAllocStringLen(str->buf, str->len); + if(!ret) + return E_OUTOFMEMORY; + + V_VT(res) = VT_BSTR; + V_BSTR(res) = ret; + break; + } + DEFAULT_UNREACHABLE; + } + return S_OK; + } + break; + case DISPATCH_METHOD: + if(prop->flags & (BP_GET|BP_GETPUT)) { + FIXME("Call on property\n"); + return E_FAIL; + } + break; + case DISPATCH_PROPERTYPUT: + if(!(prop->flags & BP_GETPUT)) { + FIXME("property does not support DISPATCH_PROPERTYPUT\n"); + return E_FAIL; + } + + FIXME("call put\n"); + return E_NOTIMPL; + default: + FIXME("unsupported flags %x\n", flags); + return E_NOTIMPL; + } + + argn = arg_cnt(dp); + + if(argn < prop->min_args || argn > (prop->max_args ? prop->max_args : prop->min_args)) { + WARN("invalid number of arguments\n"); + return MAKE_VBSERROR(VBSE_FUNC_ARITY_MISMATCH); + } + + assert(argn < ARRAY_SIZE(args)); + + for(i=0; i < argn; i++) { + if(V_VT(dp->rgvarg+dp->cArgs-i-1) == (VT_BYREF|VT_VARIANT)) + args[i] = *V_VARIANTREF(dp->rgvarg+dp->cArgs-i-1); + else + args[i] = dp->rgvarg[dp->cArgs-i-1]; + } + + return prop->proc(This, args, dp->cArgs, res); +} + +static const IDispatchVtbl BuiltinDispVtbl = { + Builtin_QueryInterface, + Builtin_AddRef, + Builtin_Release, + Builtin_GetTypeInfoCount, + Builtin_GetTypeInfo, + Builtin_GetIDsOfNames, + Builtin_Invoke +}; + +static HRESULT create_builtin_dispatch(script_ctx_t *ctx, const builtin_prop_t *members, size_t member_cnt, BuiltinDisp **ret) +{ + BuiltinDisp *disp; + + if(!(disp = heap_alloc(sizeof(*disp)))) + return E_OUTOFMEMORY; + + disp->IDispatch_iface.lpVtbl = &BuiltinDispVtbl; + disp->ref = 1; + disp->members = members; + disp->member_cnt = member_cnt; + disp->ctx = ctx; + + *ret = disp; + return S_OK; +} + static IInternetHostSecurityManager *get_sec_mgr(script_ctx_t *ctx) { IInternetHostSecurityManager *secmgr; @@ -202,6 +449,19 @@ static HRESULT to_string(VARIANT *v, BSTR *ret) return S_OK; } +static HRESULT to_system_time(VARIANT *v, SYSTEMTIME *st) +{ + VARIANT date; + HRESULT hres; + + V_VT(&date) = VT_EMPTY; + hres = VariantChangeType(&date, v, 0, VT_DATE); + if(FAILED(hres)) + return hres; + + return VariantTimeToSystemTime(V_DATE(&date), st); +} + static HRESULT set_object_site(script_ctx_t *ctx, IUnknown *obj) { IObjectWithSite *obj_site; @@ -333,7 +593,7 @@ static HRESULT show_msgbox(script_ctx_t *ctx, BSTR prompt, unsigned type, BSTR o if(orig_title && *orig_title) { WCHAR *ptr; - title = title_buf = heap_alloc(sizeof(vbscriptW) + (strlenW(orig_title)+2)*sizeof(WCHAR)); + title = title_buf = heap_alloc(sizeof(vbscriptW) + (lstrlenW(orig_title)+2)*sizeof(WCHAR)); if(!title) return E_OUTOFMEMORY; @@ -342,7 +602,7 @@ static HRESULT show_msgbox(script_ctx_t *ctx, BSTR prompt, unsigned type, BSTR o *ptr++ = ':'; *ptr++ = ' '; - strcpyW(ptr, orig_title); + lstrcpyW(ptr, orig_title); }else { title = vbscriptW; } @@ -369,7 +629,7 @@ static HRESULT show_msgbox(script_ctx_t *ctx, BSTR prompt, unsigned type, BSTR o return return_short(res, ret); } -static HRESULT Global_CCur(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_CCur(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { VARIANT v; HRESULT hres; @@ -392,7 +652,7 @@ static HRESULT Global_CCur(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI return S_OK; } -static HRESULT Global_CInt(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_CInt(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { VARIANT v; HRESULT hres; @@ -414,7 +674,7 @@ static HRESULT Global_CInt(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI } } -static HRESULT Global_CLng(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_CLng(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { int i; HRESULT hres; @@ -432,7 +692,7 @@ static HRESULT Global_CLng(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI return return_int(res, i); } -static HRESULT Global_CBool(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_CBool(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { VARIANT v; HRESULT hres; @@ -453,7 +713,7 @@ static HRESULT Global_CBool(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VAR return S_OK; } -static HRESULT Global_CByte(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_CByte(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { VARIANT v; HRESULT hres; @@ -476,13 +736,13 @@ static HRESULT Global_CByte(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VAR return S_OK; } -static HRESULT Global_CDate(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_CDate(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_CDbl(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_CDbl(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { VARIANT v; HRESULT hres; @@ -504,7 +764,7 @@ static HRESULT Global_CDbl(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI } } -static HRESULT Global_CSng(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_CSng(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { VARIANT v; HRESULT hres; @@ -525,13 +785,16 @@ static HRESULT Global_CSng(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI return S_OK; } -static HRESULT Global_CStr(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_CStr(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { BSTR str; HRESULT hres; TRACE("%s\n", debugstr_variant(arg)); + if(V_VT(arg) == VT_NULL) + return MAKE_VBSERROR(VBSE_ILLEGAL_NULL_USE); + hres = to_string(arg, &str); if(FAILED(hres)) return hres; @@ -544,7 +807,7 @@ static inline WCHAR hex_char(unsigned n) return n < 10 ? '0'+n : 'A'+n-10; } -static HRESULT Global_Hex(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Hex(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { WCHAR buf[17], *ptr; DWORD n; @@ -585,7 +848,7 @@ static HRESULT Global_Hex(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return return_string(res, ptr); } -static HRESULT Global_Oct(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Oct(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { HRESULT hres; WCHAR buf[23], *ptr; @@ -626,27 +889,30 @@ static HRESULT Global_Oct(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return return_string(res, ptr); } -static HRESULT Global_VarType(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_VarType(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { + VARTYPE vt; + TRACE("(%s)\n", debugstr_variant(arg)); assert(args_cnt == 1); - if(V_VT(arg) & ~VT_TYPEMASK) { + vt = V_VT(arg) & ~VT_BYREF; + if(vt & ~(VT_TYPEMASK | VT_ARRAY)) { FIXME("not supported %s\n", debugstr_variant(arg)); return E_NOTIMPL; } - return return_short(res, V_VT(arg)); + return return_short(res, vt); } -static HRESULT Global_IsDate(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_IsDate(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_IsEmpty(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_IsEmpty(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { TRACE("(%s)\n", debugstr_variant(arg)); @@ -659,7 +925,7 @@ static HRESULT Global_IsEmpty(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, V return S_OK; } -static HRESULT Global_IsNull(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_IsNull(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { TRACE("(%s)\n", debugstr_variant(arg)); @@ -672,7 +938,7 @@ static HRESULT Global_IsNull(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VA return S_OK; } -static HRESULT Global_IsNumeric(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_IsNumeric(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { HRESULT hres; double d; @@ -686,13 +952,13 @@ static HRESULT Global_IsNumeric(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, return return_bool(res, SUCCEEDED(hres)); } -static HRESULT Global_IsArray(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_IsArray(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_IsObject(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_IsObject(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { TRACE("(%s)\n", debugstr_variant(arg)); @@ -705,7 +971,7 @@ static HRESULT Global_IsObject(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, return S_OK; } -static HRESULT Global_Atn(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Atn(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { HRESULT hres; double d; @@ -717,7 +983,7 @@ static HRESULT Global_Atn(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return return_double(res, atan(d)); } -static HRESULT Global_Cos(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Cos(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { HRESULT hres; double d; @@ -729,7 +995,7 @@ static HRESULT Global_Cos(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return return_double(res, cos(d)); } -static HRESULT Global_Sin(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Sin(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { HRESULT hres; double d; @@ -741,7 +1007,7 @@ static HRESULT Global_Sin(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return return_double(res, sin(d)); } -static HRESULT Global_Tan(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Tan(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { HRESULT hres; double d; @@ -753,7 +1019,7 @@ static HRESULT Global_Tan(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return return_double(res, tan(d)); } -static HRESULT Global_Exp(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Exp(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { HRESULT hres; double d; @@ -765,7 +1031,7 @@ static HRESULT Global_Exp(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return return_double(res, exp(d)); } -static HRESULT Global_Log(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Log(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { HRESULT hres; double d; @@ -780,7 +1046,7 @@ static HRESULT Global_Log(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return return_double(res, log(d)); } -static HRESULT Global_Sqr(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Sqr(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { HRESULT hres; double d; @@ -795,19 +1061,19 @@ static HRESULT Global_Sqr(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return return_double(res, sqrt(d)); } -static HRESULT Global_Randomize(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Randomize(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Rnd(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Rnd(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Timer(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Timer(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { SYSTEMTIME lt; double sec; @@ -818,13 +1084,13 @@ static HRESULT Global_Timer(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VAR } -static HRESULT Global_LBound(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_LBound(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_UBound(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_UBound(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { SAFEARRAY *sa; HRESULT hres; @@ -862,7 +1128,7 @@ static HRESULT Global_UBound(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VA return return_int(res, ubound); } -static HRESULT Global_RGB(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_RGB(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { HRESULT hres; int i, color[3]; @@ -884,7 +1150,7 @@ static HRESULT Global_RGB(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return return_int(res, RGB(color[0], color[1], color[2])); } -static HRESULT Global_Len(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Len(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { DWORD len; HRESULT hres; @@ -910,13 +1176,13 @@ static HRESULT Global_Len(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return return_int(res, len); } -static HRESULT Global_LenB(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_LenB(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Left(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Left(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { BSTR str, ret, conv_str = NULL; int len, str_len; @@ -954,13 +1220,13 @@ static HRESULT Global_Left(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VAR return return_bstr(res, ret); } -static HRESULT Global_LeftB(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_LeftB(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Right(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Right(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { BSTR str, ret, conv_str = NULL; int len, str_len; @@ -998,13 +1264,13 @@ static HRESULT Global_Right(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VA return return_bstr(res, ret); } -static HRESULT Global_RightB(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_RightB(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Mid(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Mid(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { int len = -1, start, str_len; BSTR str; @@ -1057,13 +1323,13 @@ static HRESULT Global_Mid(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARI return S_OK; } -static HRESULT Global_MidB(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_MidB(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_StrComp(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT Global_StrComp(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { BSTR left, right; int mode, ret; @@ -1098,7 +1364,7 @@ static HRESULT Global_StrComp(vbdisp_t *This, VARIANT *args, unsigned args_cnt, return hres; } - ret = mode ? strcmpiW(left, right) : strcmpW(left, right); + ret = mode ? wcsicmp(left, right) : wcscmp(left, right); val = ret < 0 ? -1 : (ret > 0 ? 1 : 0); SysFreeString(left); @@ -1106,7 +1372,7 @@ static HRESULT Global_StrComp(vbdisp_t *This, VARIANT *args, unsigned args_cnt, return return_short(res, val); } -static HRESULT Global_LCase(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_LCase(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { BSTR str; HRESULT hres; @@ -1127,7 +1393,7 @@ static HRESULT Global_LCase(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VAR WCHAR *ptr; for(ptr = str; *ptr; ptr++) - *ptr = tolowerW(*ptr); + *ptr = towlower(*ptr); V_VT(res) = VT_BSTR; V_BSTR(res) = str; @@ -1137,7 +1403,7 @@ static HRESULT Global_LCase(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VAR return S_OK; } -static HRESULT Global_UCase(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_UCase(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { BSTR str; HRESULT hres; @@ -1158,7 +1424,7 @@ static HRESULT Global_UCase(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VAR WCHAR *ptr; for(ptr = str; *ptr; ptr++) - *ptr = toupperW(*ptr); + *ptr = towupper(*ptr); V_VT(res) = VT_BSTR; V_BSTR(res) = str; @@ -1168,7 +1434,7 @@ static HRESULT Global_UCase(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VAR return S_OK; } -static HRESULT Global_LTrim(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_LTrim(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { BSTR str, conv_str = NULL; WCHAR *ptr; @@ -1185,7 +1451,7 @@ static HRESULT Global_LTrim(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VAR str = conv_str; } - for(ptr = str; *ptr && isspaceW(*ptr); ptr++); + for(ptr = str; *ptr && iswspace(*ptr); ptr++); str = SysAllocString(ptr); SysFreeString(conv_str); @@ -1195,7 +1461,7 @@ static HRESULT Global_LTrim(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VAR return return_bstr(res, str); } -static HRESULT Global_RTrim(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_RTrim(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { BSTR str, conv_str = NULL; WCHAR *ptr; @@ -1212,7 +1478,7 @@ static HRESULT Global_RTrim(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VAR str = conv_str; } - for(ptr = str+SysStringLen(str); ptr-1 > str && isspaceW(*(ptr-1)); ptr--); + for(ptr = str+SysStringLen(str); ptr-1 > str && iswspace(*(ptr-1)); ptr--); str = SysAllocStringLen(str, ptr-str); SysFreeString(conv_str); @@ -1222,7 +1488,7 @@ static HRESULT Global_RTrim(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VAR return return_bstr(res, str); } -static HRESULT Global_Trim(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Trim(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { BSTR str, conv_str = NULL; WCHAR *begin_ptr, *end_ptr; @@ -1239,8 +1505,8 @@ static HRESULT Global_Trim(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI str = conv_str; } - for(begin_ptr = str; *begin_ptr && isspaceW(*begin_ptr); begin_ptr++); - for(end_ptr = str+SysStringLen(str); end_ptr-1 > begin_ptr && isspaceW(*(end_ptr-1)); end_ptr--); + for(begin_ptr = str; *begin_ptr && iswspace(*begin_ptr); begin_ptr++); + for(end_ptr = str+SysStringLen(str); end_ptr-1 > begin_ptr && iswspace(*(end_ptr-1)); end_ptr--); str = SysAllocStringLen(begin_ptr, end_ptr-begin_ptr); SysFreeString(conv_str); @@ -1250,7 +1516,7 @@ static HRESULT Global_Trim(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI return return_bstr(res, str); } -static HRESULT Global_Space(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Space(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { BSTR str; int n, i; @@ -1282,13 +1548,13 @@ static HRESULT Global_Space(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VAR return S_OK; } -static HRESULT Global_String(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_String(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_InStr(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT Global_InStr(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { VARIANT *startv, *str1v, *str2v; BSTR str1, str2; @@ -1346,7 +1612,7 @@ static HRESULT Global_InStr(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VA if(start < SysStringLen(str1)) { WCHAR *ptr; - ptr = strstrW(str1+start, str2); + ptr = wcsstr(str1+start, str2); ret = ptr ? ptr-str1+1 : 0; }else { ret = 0; @@ -1355,34 +1621,58 @@ static HRESULT Global_InStr(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VA return return_int(res, ret); } -static HRESULT Global_InStrB(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_InStrB(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_AscB(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_AscB(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_ChrB(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_ChrB(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Asc(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Asc(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + BSTR conv_str = NULL, str; + HRESULT hres = S_OK; + + TRACE("(%s)\n", debugstr_variant(arg)); + + switch(V_VT(arg)) { + case VT_NULL: + return MAKE_VBSERROR(VBSE_ILLEGAL_NULL_USE); + case VT_EMPTY: + return MAKE_VBSERROR(VBSE_ILLEGAL_FUNC_CALL); + case VT_BSTR: + str = V_BSTR(arg); + break; + default: + hres = to_string(arg, &conv_str); + if(FAILED(hres)) + return hres; + str = conv_str; + } + + if(!SysStringLen(str) || *str >= 0x100) + hres = MAKE_VBSERROR(VBSE_ILLEGAL_FUNC_CALL); + else if(res) + hres = return_short(res, *str); + SysFreeString(conv_str); + return hres; } /* The function supports only single-byte and double-byte character sets. It * ignores language specified by IActiveScriptSite::GetLCID. The argument needs * to be in range of short or unsigned short. */ -static HRESULT Global_Chr(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Chr(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { int cp, c, len = 0; CPINFO cpi; @@ -1424,19 +1714,19 @@ static HRESULT Global_Chr(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return S_OK; } -static HRESULT Global_AscW(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_AscW(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_ChrW(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_ChrW(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Abs(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Abs(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { HRESULT hres; VARIANT dst; @@ -1457,7 +1747,7 @@ static HRESULT Global_Abs(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return S_OK; } -static HRESULT Global_Fix(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Fix(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { HRESULT hres; VARIANT dst; @@ -1478,7 +1768,7 @@ static HRESULT Global_Fix(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return S_OK; } -static HRESULT Global_Int(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Int(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { HRESULT hres; VARIANT dst; @@ -1499,7 +1789,7 @@ static HRESULT Global_Int(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return S_OK; } -static HRESULT Global_Sgn(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Sgn(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { double v; short val; @@ -1520,7 +1810,7 @@ static HRESULT Global_Sgn(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return return_short(res, val); } -static HRESULT Global_Now(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Now(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { SYSTEMTIME lt; double date; @@ -1532,7 +1822,7 @@ static HRESULT Global_Now(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA return return_date(res, date); } -static HRESULT Global_Date(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Date(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { SYSTEMTIME lt; UDATE ud; @@ -1550,7 +1840,7 @@ static HRESULT Global_Date(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI return return_date(res, date); } -static HRESULT Global_Time(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Time(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { SYSTEMTIME lt; UDATE ud; @@ -1568,79 +1858,109 @@ static HRESULT Global_Time(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI return return_date(res, time); } -static HRESULT Global_Day(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Day(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + SYSTEMTIME st; + HRESULT hres; + + TRACE("(%s)\n", debugstr_variant(arg)); + + hres = to_system_time(arg, &st); + return FAILED(hres) ? hres : return_short(res, st.wDay); } -static HRESULT Global_Month(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Month(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + SYSTEMTIME st; + HRESULT hres; + + TRACE("(%s)\n", debugstr_variant(arg)); + + hres = to_system_time(arg, &st); + return FAILED(hres) ? hres : return_short(res, st.wMonth); } -static HRESULT Global_Weekday(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Weekday(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Year(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Year(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + SYSTEMTIME st; + HRESULT hres; + + TRACE("(%s)\n", debugstr_variant(arg)); + + hres = to_system_time(arg, &st); + return FAILED(hres) ? hres : return_short(res, st.wYear); } -static HRESULT Global_Hour(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Hour(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + SYSTEMTIME st; + HRESULT hres; + + TRACE("(%s)\n", debugstr_variant(arg)); + + hres = to_system_time(arg, &st); + return FAILED(hres) ? hres : return_short(res, st.wHour); } -static HRESULT Global_Minute(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Minute(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + SYSTEMTIME st; + HRESULT hres; + + TRACE("(%s)\n", debugstr_variant(arg)); + + hres = to_system_time(arg, &st); + return FAILED(hres) ? hres : return_short(res, st.wMinute); } -static HRESULT Global_Second(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Second(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + SYSTEMTIME st; + HRESULT hres; + + TRACE("(%s)\n", debugstr_variant(arg)); + + hres = to_system_time(arg, &st); + return FAILED(hres) ? hres : return_short(res, st.wSecond); } -static HRESULT Global_DateValue(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_DateValue(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_TimeValue(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_TimeValue(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_DateSerial(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_DateSerial(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_TimeSerial(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_TimeSerial(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_InputBox(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_InputBox(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_MsgBox(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT Global_MsgBox(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { BSTR prompt, title = NULL; int type = MB_OK; @@ -1666,14 +1986,14 @@ static HRESULT Global_MsgBox(vbdisp_t *This, VARIANT *args, unsigned args_cnt, V } if(SUCCEEDED(hres)) - hres = show_msgbox(This->desc->ctx, prompt, type, title, res); + hres = show_msgbox(This->ctx, prompt, type, title, res); SysFreeString(prompt); SysFreeString(title); return hres; } -static HRESULT Global_CreateObject(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_CreateObject(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { IUnknown *obj; HRESULT hres; @@ -1685,7 +2005,7 @@ static HRESULT Global_CreateObject(vbdisp_t *This, VARIANT *arg, unsigned args_c return E_INVALIDARG; } - obj = create_object(This->desc->ctx, V_BSTR(arg)); + obj = create_object(This->ctx, V_BSTR(arg)); if(!obj) return VB_E_CANNOT_CREATE_OBJ; @@ -1701,7 +2021,7 @@ static HRESULT Global_CreateObject(vbdisp_t *This, VARIANT *arg, unsigned args_c return S_OK; } -static HRESULT Global_GetObject(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT Global_GetObject(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { IBindCtx *bind_ctx; IUnknown *obj_unk; @@ -1717,7 +2037,7 @@ static HRESULT Global_GetObject(vbdisp_t *This, VARIANT *args, unsigned args_cnt return E_NOTIMPL; } - if(This->desc->ctx->safeopt & (INTERFACE_USES_SECURITY_MANAGER|INTERFACESAFE_FOR_UNTRUSTED_DATA)) { + if(This->ctx->safeopt & (INTERFACE_USES_SECURITY_MANAGER|INTERFACESAFE_FOR_UNTRUSTED_DATA)) { WARN("blocked in current safety mode\n"); return VB_E_CANNOT_CREATE_OBJ; } @@ -1737,7 +2057,7 @@ static HRESULT Global_GetObject(vbdisp_t *This, VARIANT *args, unsigned args_cnt if(FAILED(hres)) return hres; - hres = set_object_site(This->desc->ctx, obj_unk); + hres = set_object_site(This->ctx, obj_unk); if(FAILED(hres)) { IUnknown_Release(obj_unk); return hres; @@ -1758,25 +2078,25 @@ static HRESULT Global_GetObject(vbdisp_t *This, VARIANT *args, unsigned args_cnt return hres; } -static HRESULT Global_DateAdd(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_DateAdd(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_DateDiff(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_DateDiff(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_DatePart(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_DatePart(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_TypeName(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_TypeName(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { static const WCHAR ByteW[] = {'B', 'y', 't', 'e', 0}; static const WCHAR IntegerW[] = {'I', 'n', 't', 'e', 'g', 'e', 'r', 0}; @@ -1826,7 +2146,7 @@ static HRESULT Global_TypeName(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, } } -static HRESULT Global_Array(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Array(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { SAFEARRAYBOUND bounds; SAFEARRAY *sa; @@ -1868,37 +2188,37 @@ static HRESULT Global_Array(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VAR return S_OK; } -static HRESULT Global_Erase(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Erase(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Filter(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Filter(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Join(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Join(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Split(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Split(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Replace(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Replace(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_StrReverse(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_StrReverse(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { WCHAR *ptr1, *ptr2, ch; BSTR ret; @@ -1921,7 +2241,7 @@ static HRESULT Global_StrReverse(vbdisp_t *This, VARIANT *arg, unsigned args_cnt return return_bstr(res, ret); } -static HRESULT Global_InStrRev(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT Global_InStrRev(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { int start, ret = 0; BSTR str1, str2; @@ -1981,13 +2301,13 @@ static HRESULT Global_InStrRev(vbdisp_t *This, VARIANT *args, unsigned args_cnt, return return_int(res, ret); } -static HRESULT Global_LoadPicture(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_LoadPicture(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_ScriptEngine(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_ScriptEngine(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { TRACE("%s\n", debugstr_variant(arg)); @@ -1996,7 +2316,7 @@ static HRESULT Global_ScriptEngine(vbdisp_t *This, VARIANT *arg, unsigned args_c return return_string(res, vbscriptW); } -static HRESULT Global_ScriptEngineMajorVersion(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_ScriptEngineMajorVersion(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { TRACE("%s\n", debugstr_variant(arg)); @@ -2005,7 +2325,7 @@ static HRESULT Global_ScriptEngineMajorVersion(vbdisp_t *This, VARIANT *arg, uns return return_int(res, VBSCRIPT_MAJOR_VERSION); } -static HRESULT Global_ScriptEngineMinorVersion(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_ScriptEngineMinorVersion(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { TRACE("%s\n", debugstr_variant(arg)); @@ -2014,7 +2334,7 @@ static HRESULT Global_ScriptEngineMinorVersion(vbdisp_t *This, VARIANT *arg, uns return return_int(res, VBSCRIPT_MINOR_VERSION); } -static HRESULT Global_ScriptEngineBuildVersion(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_ScriptEngineBuildVersion(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { TRACE("%s\n", debugstr_variant(arg)); @@ -2023,31 +2343,31 @@ static HRESULT Global_ScriptEngineBuildVersion(vbdisp_t *This, VARIANT *arg, uns return return_int(res, VBSCRIPT_BUILD_VERSION); } -static HRESULT Global_FormatNumber(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_FormatNumber(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_FormatCurrency(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_FormatCurrency(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_FormatPercent(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_FormatPercent(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_FormatDateTime(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_FormatDateTime(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_WeekdayName(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT Global_WeekdayName(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { int weekday, first_day = 1, abbrev = 0; BSTR ret; @@ -2080,7 +2400,7 @@ static HRESULT Global_WeekdayName(vbdisp_t *This, VARIANT *args, unsigned args_c return return_bstr(res, ret); } -static HRESULT Global_MonthName(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT Global_MonthName(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { int month, abbrev = 0; BSTR ret; @@ -2107,7 +2427,7 @@ static HRESULT Global_MonthName(vbdisp_t *This, VARIANT *args, unsigned args_cnt return return_bstr(res, ret); } -static HRESULT Global_Round(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Round(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { double n; HRESULT hres; @@ -2135,42 +2455,57 @@ static HRESULT Global_Round(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VAR return return_double(res, round(n)); } -static HRESULT Global_Escape(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Escape(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Unescape(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Unescape(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Eval(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Eval(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_Execute(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Execute(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_ExecuteGlobal(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_ExecuteGlobal(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Global_GetRef(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_GetRef(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { FIXME("\n"); return E_NOTIMPL; } +static HRESULT Global_Err(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +{ + TRACE("\n"); + + if(args_cnt) { + FIXME("Setter not supported\n"); + return E_NOTIMPL; + } + + V_VT(res) = VT_DISPATCH; + V_DISPATCH(res) = &This->ctx->err_obj->IDispatch_iface; + IDispatch_AddRef(V_DISPATCH(res)); + return S_OK; +} + static const string_constant_t vbCr = {1, {'\r'}}; static const string_constant_t vbCrLf = {2, {'\r','\n'}}; static const string_constant_t vbNewLine = {2, {'\r','\n'}}; @@ -2182,296 +2517,363 @@ static const string_constant_t vbTab = {1, {'\t'}}; static const string_constant_t vbVerticalTab = {1, {0xb}}; static const builtin_prop_t global_props[] = { - {DISPID_GLOBAL_VBUSESYSTEM, NULL, BP_GET, VT_I2, 0}, - {DISPID_GLOBAL_USESYSTEMDAYOFWEEK, NULL, BP_GET, VT_I2, 0}, - {DISPID_GLOBAL_VBSUNDAY, NULL, BP_GET, VT_I2, 1}, - {DISPID_GLOBAL_VBMONDAY, NULL, BP_GET, VT_I2, 2}, - {DISPID_GLOBAL_VBTUESDAY, NULL, BP_GET, VT_I2, 3}, - {DISPID_GLOBAL_VBWEDNESDAY, NULL, BP_GET, VT_I2, 4}, - {DISPID_GLOBAL_VBTHURSDAY, NULL, BP_GET, VT_I2, 5}, - {DISPID_GLOBAL_VBFRIDAY, NULL, BP_GET, VT_I2, 6}, - {DISPID_GLOBAL_VBSATURDAY, NULL, BP_GET, VT_I2, 7}, - {DISPID_GLOBAL_VBFIRSTJAN1, NULL, BP_GET, VT_I2, 1}, - {DISPID_GLOBAL_VBFIRSTFOURDAYS, NULL, BP_GET, VT_I2, 2}, - {DISPID_GLOBAL_VBFIRSTFULLWEEK, NULL, BP_GET, VT_I2, 3}, - {DISPID_GLOBAL_VBOKONLY, NULL, BP_GET, VT_I2, MB_OK}, - {DISPID_GLOBAL_VBOKCANCEL, NULL, BP_GET, VT_I2, MB_OKCANCEL}, - {DISPID_GLOBAL_VBABORTRETRYIGNORE, NULL, BP_GET, VT_I2, MB_ABORTRETRYIGNORE}, - {DISPID_GLOBAL_VBYESNOCANCEL, NULL, BP_GET, VT_I2, MB_YESNOCANCEL}, - {DISPID_GLOBAL_VBYESNO, NULL, BP_GET, VT_I2, MB_YESNO}, - {DISPID_GLOBAL_VBRETRYCANCEL, NULL, BP_GET, VT_I2, MB_RETRYCANCEL}, - {DISPID_GLOBAL_VBCRITICAL, NULL, BP_GET, VT_I2, MB_ICONHAND}, - {DISPID_GLOBAL_VBQUESTION, NULL, BP_GET, VT_I2, MB_ICONQUESTION}, - {DISPID_GLOBAL_VBEXCLAMATION, NULL, BP_GET, VT_I2, MB_ICONEXCLAMATION}, - {DISPID_GLOBAL_VBINFORMATION, NULL, BP_GET, VT_I2, MB_ICONASTERISK}, - {DISPID_GLOBAL_VBDEFAULTBUTTON1, NULL, BP_GET, VT_I2, MB_DEFBUTTON1}, - {DISPID_GLOBAL_VBDEFAULTBUTTON2, NULL, BP_GET, VT_I2, MB_DEFBUTTON2}, - {DISPID_GLOBAL_VBDEFAULTBUTTON3, NULL, BP_GET, VT_I2, MB_DEFBUTTON3}, - {DISPID_GLOBAL_VBDEFAULTBUTTON4, NULL, BP_GET, VT_I2, MB_DEFBUTTON4}, - {DISPID_GLOBAL_VBAPPLICATIONMODAL, NULL, BP_GET, VT_I2, MB_APPLMODAL}, - {DISPID_GLOBAL_VBSYSTEMMODAL, NULL, BP_GET, VT_I2, MB_SYSTEMMODAL}, - {DISPID_GLOBAL_VBOK, NULL, BP_GET, VT_I2, IDOK}, - {DISPID_GLOBAL_VBCANCEL, NULL, BP_GET, VT_I2, IDCANCEL}, - {DISPID_GLOBAL_VBABORT, NULL, BP_GET, VT_I2, IDABORT}, - {DISPID_GLOBAL_VBRETRY, NULL, BP_GET, VT_I2, IDRETRY}, - {DISPID_GLOBAL_VBIGNORE, NULL, BP_GET, VT_I2, IDIGNORE}, - {DISPID_GLOBAL_VBYES, NULL, BP_GET, VT_I2, IDYES}, - {DISPID_GLOBAL_VBNO, NULL, BP_GET, VT_I2, IDNO}, - {DISPID_GLOBAL_VBEMPTY, NULL, BP_GET, VT_I2, VT_EMPTY}, - {DISPID_GLOBAL_VBNULL, NULL, BP_GET, VT_I2, VT_NULL}, - {DISPID_GLOBAL_VBINTEGER, NULL, BP_GET, VT_I2, VT_I2}, - {DISPID_GLOBAL_VBLONG, NULL, BP_GET, VT_I2, VT_I4}, - {DISPID_GLOBAL_VBSINGLE, NULL, BP_GET, VT_I2, VT_R4}, - {DISPID_GLOBAL_VBDOUBLE, NULL, BP_GET, VT_I2, VT_R8}, - {DISPID_GLOBAL_VBCURRENCY, NULL, BP_GET, VT_I2, VT_CY}, - {DISPID_GLOBAL_VBDATE, NULL, BP_GET, VT_I2, VT_DATE}, - {DISPID_GLOBAL_VBSTRING, NULL, BP_GET, VT_I2, VT_BSTR}, - {DISPID_GLOBAL_VBOBJECT, NULL, BP_GET, VT_I2, VT_DISPATCH}, - {DISPID_GLOBAL_VBERROR, NULL, BP_GET, VT_I2, VT_ERROR}, - {DISPID_GLOBAL_VBBOOLEAN, NULL, BP_GET, VT_I2, VT_BOOL}, - {DISPID_GLOBAL_VBVARIANT, NULL, BP_GET, VT_I2, VT_VARIANT}, - {DISPID_GLOBAL_VBDATAOBJECT, NULL, BP_GET, VT_I2, VT_UNKNOWN}, - {DISPID_GLOBAL_VBDECIMAL, NULL, BP_GET, VT_I2, VT_DECIMAL}, - {DISPID_GLOBAL_VBBYTE, NULL, BP_GET, VT_I2, VT_UI1}, - {DISPID_GLOBAL_VBARRAY, NULL, BP_GET, VT_I2, VT_ARRAY}, - {DISPID_GLOBAL_VBTRUE, NULL, BP_GET, VT_I2, VARIANT_TRUE}, - {DISPID_GLOBAL_VBFALSE, NULL, BP_GET, VT_I2, VARIANT_FALSE}, - {DISPID_GLOBAL_VBUSEDEFAULT, NULL, BP_GET, VT_I2, -2}, - {DISPID_GLOBAL_VBBINARYCOMPARE, NULL, BP_GET, VT_I2, 0}, - {DISPID_GLOBAL_VBTEXTCOMPARE, NULL, BP_GET, VT_I2, 1}, - {DISPID_GLOBAL_VBDATABASECOMPARE, NULL, BP_GET, VT_I2, 2}, - {DISPID_GLOBAL_VBGENERALDATE, NULL, BP_GET, VT_I2, 0}, - {DISPID_GLOBAL_VBLONGDATE, NULL, BP_GET, VT_I2, 1}, - {DISPID_GLOBAL_VBSHORTDATE, NULL, BP_GET, VT_I2, 2}, - {DISPID_GLOBAL_VBLONGTIME, NULL, BP_GET, VT_I2, 3}, - {DISPID_GLOBAL_VBSHORTTIME, NULL, BP_GET, VT_I2, 4}, - {DISPID_GLOBAL_VBOBJECTERROR, NULL, BP_GET, VT_I4, 0x80040000}, - {DISPID_GLOBAL_VBBLACK, NULL, BP_GET, VT_I4, 0x000000}, - {DISPID_GLOBAL_VBBLUE, NULL, BP_GET, VT_I4, 0xff0000}, - {DISPID_GLOBAL_VBCYAN, NULL, BP_GET, VT_I4, 0xffff00}, - {DISPID_GLOBAL_VBGREEN, NULL, BP_GET, VT_I4, 0x00ff00}, - {DISPID_GLOBAL_VBMAGENTA, NULL, BP_GET, VT_I4, 0xff00ff}, - {DISPID_GLOBAL_VBRED, NULL, BP_GET, VT_I4, 0x0000ff}, - {DISPID_GLOBAL_VBWHITE, NULL, BP_GET, VT_I4, 0xffffff}, - {DISPID_GLOBAL_VBYELLOW, NULL, BP_GET, VT_I4, 0x00ffff}, - {DISPID_GLOBAL_VBCR, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbCr}, - {DISPID_GLOBAL_VBCRLF, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbCrLf}, - {DISPID_GLOBAL_VBNEWLINE, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbNewLine}, - {DISPID_GLOBAL_VBFORMFEED, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbFormFeed}, - {DISPID_GLOBAL_VBLF, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbLf}, - {DISPID_GLOBAL_VBNULLCHAR, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbNullChar}, - {DISPID_GLOBAL_VBNULLSTRING, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbNullString}, - {DISPID_GLOBAL_VBTAB, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbTab}, - {DISPID_GLOBAL_VBVERTICALTAB, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbVerticalTab}, - {DISPID_GLOBAL_CCUR, Global_CCur, 0, 1}, - {DISPID_GLOBAL_CINT, Global_CInt, 0, 1}, - {DISPID_GLOBAL_CLNG, Global_CLng, 0, 1}, - {DISPID_GLOBAL_CBOOL, Global_CBool, 0, 1}, - {DISPID_GLOBAL_CBYTE, Global_CByte, 0, 1}, - {DISPID_GLOBAL_CDATE, Global_CDate, 0, 1}, - {DISPID_GLOBAL_CDBL, Global_CDbl, 0, 1}, - {DISPID_GLOBAL_CSNG, Global_CSng, 0, 1}, - {DISPID_GLOBAL_CSTR, Global_CStr, 0, 1}, - {DISPID_GLOBAL_HEX, Global_Hex, 0, 1}, - {DISPID_GLOBAL_OCT, Global_Oct, 0, 1}, - {DISPID_GLOBAL_VARTYPE, Global_VarType, 0, 1}, - {DISPID_GLOBAL_ISDATE, Global_IsDate, 0, 1}, - {DISPID_GLOBAL_ISEMPTY, Global_IsEmpty, 0, 1}, - {DISPID_GLOBAL_ISNULL, Global_IsNull, 0, 1}, - {DISPID_GLOBAL_ISNUMERIC, Global_IsNumeric, 0, 1}, - {DISPID_GLOBAL_ISARRAY, Global_IsArray, 0, 1}, - {DISPID_GLOBAL_ISOBJECT, Global_IsObject, 0, 1}, - {DISPID_GLOBAL_ATN, Global_Atn, 0, 1}, - {DISPID_GLOBAL_COS, Global_Cos, 0, 1}, - {DISPID_GLOBAL_SIN, Global_Sin, 0, 1}, - {DISPID_GLOBAL_TAN, Global_Tan, 0, 1}, - {DISPID_GLOBAL_EXP, Global_Exp, 0, 1}, - {DISPID_GLOBAL_LOG, Global_Log, 0, 1}, - {DISPID_GLOBAL_SQR, Global_Sqr, 0, 1}, - {DISPID_GLOBAL_RANDOMIZE, Global_Randomize, 0, 1}, - {DISPID_GLOBAL_RND, Global_Rnd, 0, 1}, - {DISPID_GLOBAL_TIMER, Global_Timer, 0, 0}, - {DISPID_GLOBAL_LBOUND, Global_LBound, 0, 1}, - {DISPID_GLOBAL_UBOUND, Global_UBound, 0, 1, 2}, - {DISPID_GLOBAL_RGB, Global_RGB, 0, 3}, - {DISPID_GLOBAL_LEN, Global_Len, 0, 1}, - {DISPID_GLOBAL_LENB, Global_LenB, 0, 1}, - {DISPID_GLOBAL_LEFT, Global_Left, 0, 2}, - {DISPID_GLOBAL_LEFTB, Global_LeftB, 0, 2}, - {DISPID_GLOBAL_RIGHT, Global_Right, 0, 2}, - {DISPID_GLOBAL_RIGHTB, Global_RightB, 0, 2}, - {DISPID_GLOBAL_MID, Global_Mid, 0, 2, 3}, - {DISPID_GLOBAL_MIDB, Global_MidB, 0, 2, 3}, - {DISPID_GLOBAL_STRCOMP, Global_StrComp, 0, 2, 3}, - {DISPID_GLOBAL_LCASE, Global_LCase, 0, 1}, - {DISPID_GLOBAL_UCASE, Global_UCase, 0, 1}, - {DISPID_GLOBAL_LTRIM, Global_LTrim, 0, 1}, - {DISPID_GLOBAL_RTRIM, Global_RTrim, 0, 1}, - {DISPID_GLOBAL_TRIM, Global_Trim, 0, 1}, - {DISPID_GLOBAL_SPACE, Global_Space, 0, 1}, - {DISPID_GLOBAL_STRING, Global_String, 0, 0, 2}, - {DISPID_GLOBAL_INSTR, Global_InStr, 0, 2, 4}, - {DISPID_GLOBAL_INSTRB, Global_InStrB, 0, 3, 4}, - {DISPID_GLOBAL_ASCB, Global_AscB, 0, 1}, - {DISPID_GLOBAL_CHRB, Global_ChrB, 0, 1}, - {DISPID_GLOBAL_ASC, Global_Asc, 0, 1}, - {DISPID_GLOBAL_CHR, Global_Chr, 0, 1}, - {DISPID_GLOBAL_ASCW, Global_AscW, 0, 1}, - {DISPID_GLOBAL_CHRW, Global_ChrW, 0, 1}, - {DISPID_GLOBAL_ABS, Global_Abs, 0, 1}, - {DISPID_GLOBAL_FIX, Global_Fix, 0, 1}, - {DISPID_GLOBAL_INT, Global_Int, 0, 1}, - {DISPID_GLOBAL_SGN, Global_Sgn, 0, 1}, - {DISPID_GLOBAL_NOW, Global_Now, 0, 0}, - {DISPID_GLOBAL_DATE, Global_Date, 0, 0}, - {DISPID_GLOBAL_TIME, Global_Time, 0, 0}, - {DISPID_GLOBAL_DAY, Global_Day, 0, 1}, - {DISPID_GLOBAL_MONTH, Global_Month, 0, 1}, - {DISPID_GLOBAL_WEEKDAY, Global_Weekday, 0, 1, 2}, - {DISPID_GLOBAL_YEAR, Global_Year, 0, 1}, - {DISPID_GLOBAL_HOUR, Global_Hour, 0, 1}, - {DISPID_GLOBAL_MINUTE, Global_Minute, 0, 1}, - {DISPID_GLOBAL_SECOND, Global_Second, 0, 1}, - {DISPID_GLOBAL_DATEVALUE, Global_DateValue, 0, 1}, - {DISPID_GLOBAL_TIMEVALUE, Global_TimeValue, 0, 1}, - {DISPID_GLOBAL_DATESERIAL, Global_DateSerial, 0, 3}, - {DISPID_GLOBAL_TIMESERIAL, Global_TimeSerial, 0, 3}, - {DISPID_GLOBAL_INPUTBOX, Global_InputBox, 0, 1, 7}, - {DISPID_GLOBAL_MSGBOX, Global_MsgBox, 0, 1, 5}, - {DISPID_GLOBAL_CREATEOBJECT, Global_CreateObject, 0, 1}, - {DISPID_GLOBAL_GETOBJECT, Global_GetObject, 0, 0, 2}, - {DISPID_GLOBAL_DATEADD, Global_DateAdd, 0, 3}, - {DISPID_GLOBAL_DATEDIFF, Global_DateDiff, 0, 3, 5}, - {DISPID_GLOBAL_DATEPART, Global_DatePart, 0, 2, 4}, - {DISPID_GLOBAL_TYPENAME, Global_TypeName, 0, 1}, - {DISPID_GLOBAL_ARRAY, Global_Array, 0, 0, MAXDWORD}, - {DISPID_GLOBAL_ERASE, Global_Erase, 0, 1}, - {DISPID_GLOBAL_FILTER, Global_Filter, 0, 2, 4}, - {DISPID_GLOBAL_JOIN, Global_Join, 0, 1, 2}, - {DISPID_GLOBAL_SPLIT, Global_Split, 0, 1, 4}, - {DISPID_GLOBAL_REPLACE, Global_Replace, 0, 3, 6}, - {DISPID_GLOBAL_STRREVERSE, Global_StrReverse, 0, 1}, - {DISPID_GLOBAL_INSTRREV, Global_InStrRev, 0, 2, 4}, - {DISPID_GLOBAL_LOADPICTURE, Global_LoadPicture, 0, 1}, - {DISPID_GLOBAL_SCRIPTENGINE, Global_ScriptEngine, 0, 0}, - {DISPID_GLOBAL_SCRIPTENGINEMAJORVERSION, Global_ScriptEngineMajorVersion, 0, 0}, - {DISPID_GLOBAL_SCRIPTENGINEMINORVERSION, Global_ScriptEngineMinorVersion, 0, 0}, - {DISPID_GLOBAL_SCRIPTENGINEBUILDVERSION, Global_ScriptEngineBuildVersion, 0, 0}, - {DISPID_GLOBAL_FORMATNUMBER, Global_FormatNumber, 0, 1, 5}, - {DISPID_GLOBAL_FORMATCURRENCY, Global_FormatCurrency, 0, 1, 5}, - {DISPID_GLOBAL_FORMATPERCENT, Global_FormatPercent, 0, 1, 5}, - {DISPID_GLOBAL_FORMATDATETIME, Global_FormatDateTime, 0, 1, 2}, - {DISPID_GLOBAL_WEEKDAYNAME, Global_WeekdayName, 0, 1, 3}, - {DISPID_GLOBAL_MONTHNAME, Global_MonthName, 0, 1, 2}, - {DISPID_GLOBAL_ROUND, Global_Round, 0, 1, 2}, - {DISPID_GLOBAL_ESCAPE, Global_Escape, 0, 1}, - {DISPID_GLOBAL_UNESCAPE, Global_Unescape, 0, 1}, - {DISPID_GLOBAL_EVAL, Global_Eval, 0, 1}, - {DISPID_GLOBAL_EXECUTE, Global_Execute, 0, 1}, - {DISPID_GLOBAL_EXECUTEGLOBAL, Global_ExecuteGlobal, 0, 1}, - {DISPID_GLOBAL_GETREF, Global_GetRef, 0, 1}, - {DISPID_GLOBAL_VBMSGBOXHELPBUTTON, NULL, BP_GET, VT_I4, MB_HELP}, - {DISPID_GLOBAL_VBMSGBOXSETFOREGROUND, NULL, BP_GET, VT_I4, MB_SETFOREGROUND}, - {DISPID_GLOBAL_VBMSGBOXRIGHT, NULL, BP_GET, VT_I4, MB_RIGHT}, - {DISPID_GLOBAL_VBMSGBOXRTLREADING, NULL, BP_GET, VT_I4, MB_RTLREADING} + {NULL}, /* no default value */ + {L"Abs", Global_Abs, 0, 1}, + {L"Array", Global_Array, 0, 0, MAXDWORD}, + {L"Asc", Global_Asc, 0, 1}, + {L"AscB", Global_AscB, 0, 1}, + {L"AscW", Global_AscW, 0, 1}, + {L"Atn", Global_Atn, 0, 1}, + {L"CBool", Global_CBool, 0, 1}, + {L"CByte", Global_CByte, 0, 1}, + {L"CCur", Global_CCur, 0, 1}, + {L"CDate", Global_CDate, 0, 1}, + {L"CDbl", Global_CDbl, 0, 1}, + {L"Chr", Global_Chr, 0, 1}, + {L"ChrB", Global_ChrB, 0, 1}, + {L"ChrW", Global_ChrW, 0, 1}, + {L"CInt", Global_CInt, 0, 1}, + {L"CLng", Global_CLng, 0, 1}, + {L"Cos", Global_Cos, 0, 1}, + {L"CreateObject", Global_CreateObject, 0, 1}, + {L"CSng", Global_CSng, 0, 1}, + {L"CStr", Global_CStr, 0, 1}, + {L"Date", Global_Date, 0, 0}, + {L"DateAdd", Global_DateAdd, 0, 3}, + {L"DateDiff", Global_DateDiff, 0, 3, 5}, + {L"DatePart", Global_DatePart, 0, 2, 4}, + {L"DateSerial", Global_DateSerial, 0, 3}, + {L"DateValue", Global_DateValue, 0, 1}, + {L"Day", Global_Day, 0, 1}, + {L"Erase", Global_Erase, 0, 1}, + {L"Err", Global_Err, BP_GETPUT}, + {L"Escape", Global_Escape, 0, 1}, + {L"Eval", Global_Eval, 0, 1}, + {L"Execute", Global_Execute, 0, 1}, + {L"ExecuteGlobal", Global_ExecuteGlobal, 0, 1}, + {L"Exp", Global_Exp, 0, 1}, + {L"Filter", Global_Filter, 0, 2, 4}, + {L"Fix", Global_Fix, 0, 1}, + {L"FormatCurrency", Global_FormatCurrency, 0, 1, 5}, + {L"FormatDateTime", Global_FormatDateTime, 0, 1, 2}, + {L"FormatNumber", Global_FormatNumber, 0, 1, 5}, + {L"FormatPercent", Global_FormatPercent, 0, 1, 5}, + {L"GetObject", Global_GetObject, 0, 0, 2}, + {L"GetRef", Global_GetRef, 0, 1}, + {L"Hex", Global_Hex, 0, 1}, + {L"Hour", Global_Hour, 0, 1}, + {L"InputBox", Global_InputBox, 0, 1, 7}, + {L"InStr", Global_InStr, 0, 2, 4}, + {L"InStrB", Global_InStrB, 0, 3, 4}, + {L"InStrRev", Global_InStrRev, 0, 2, 4}, + {L"Int", Global_Int, 0, 1}, + {L"IsArray", Global_IsArray, 0, 1}, + {L"IsDate", Global_IsDate, 0, 1}, + {L"IsEmpty", Global_IsEmpty, 0, 1}, + {L"IsNull", Global_IsNull, 0, 1}, + {L"IsNumeric", Global_IsNumeric, 0, 1}, + {L"IsObject", Global_IsObject, 0, 1}, + {L"Join", Global_Join, 0, 1, 2}, + {L"LBound", Global_LBound, 0, 1}, + {L"LCase", Global_LCase, 0, 1}, + {L"Left", Global_Left, 0, 2}, + {L"LeftB", Global_LeftB, 0, 2}, + {L"Len", Global_Len, 0, 1}, + {L"LenB", Global_LenB, 0, 1}, + {L"LoadPicture", Global_LoadPicture, 0, 1}, + {L"Log", Global_Log, 0, 1}, + {L"LTrim", Global_LTrim, 0, 1}, + {L"Mid", Global_Mid, 0, 2, 3}, + {L"MidB", Global_MidB, 0, 2, 3}, + {L"Minute", Global_Minute, 0, 1}, + {L"Month", Global_Month, 0, 1}, + {L"MonthName", Global_MonthName, 0, 1, 2}, + {L"MsgBox", Global_MsgBox, 0, 1, 5}, + {L"Now", Global_Now, 0, 0}, + {L"Oct", Global_Oct, 0, 1}, + {L"Randomize", Global_Randomize, 0, 1}, + {L"Replace", Global_Replace, 0, 3, 6}, + {L"RGB", Global_RGB, 0, 3}, + {L"Right", Global_Right, 0, 2}, + {L"RightB", Global_RightB, 0, 2}, + {L"Rnd", Global_Rnd, 0, 1}, + {L"Round", Global_Round, 0, 1, 2}, + {L"RTrim", Global_RTrim, 0, 1}, + {L"ScriptEngine", Global_ScriptEngine, 0, 0}, + {L"ScriptEngineBuildVersion", Global_ScriptEngineBuildVersion, 0, 0}, + {L"ScriptEngineMajorVersion", Global_ScriptEngineMajorVersion, 0, 0}, + {L"ScriptEngineMinorVersion", Global_ScriptEngineMinorVersion, 0, 0}, + {L"Second", Global_Second, 0, 1}, + {L"Sgn", Global_Sgn, 0, 1}, + {L"Sin", Global_Sin, 0, 1}, + {L"Space", Global_Space, 0, 1}, + {L"Split", Global_Split, 0, 1, 4}, + {L"Sqr", Global_Sqr, 0, 1}, + {L"StrComp", Global_StrComp, 0, 2, 3}, + {L"String", Global_String, 0, 0, 2}, + {L"StrReverse", Global_StrReverse, 0, 1}, + {L"Tan", Global_Tan, 0, 1}, + {L"Time", Global_Time, 0, 0}, + {L"Timer", Global_Timer, 0, 0}, + {L"TimeSerial", Global_TimeSerial, 0, 3}, + {L"TimeValue", Global_TimeValue, 0, 1}, + {L"Trim", Global_Trim, 0, 1}, + {L"TypeName", Global_TypeName, 0, 1}, + {L"UBound", Global_UBound, 0, 1, 2}, + {L"UCase", Global_UCase, 0, 1}, + {L"Unescape", Global_Unescape, 0, 1}, + {L"VarType", Global_VarType, 0, 1}, + {L"vbAbort", NULL, BP_GET, VT_I2, IDABORT}, + {L"vbAbortRetryIgnore", NULL, BP_GET, VT_I2, MB_ABORTRETRYIGNORE}, + {L"vbApplicationModal", NULL, BP_GET, VT_I2, MB_APPLMODAL}, + {L"vbArray", NULL, BP_GET, VT_I2, VT_ARRAY}, + {L"vbBinaryCompare", NULL, BP_GET, VT_I2, 0}, + {L"vbBlack", NULL, BP_GET, VT_I4, 0x000000}, + {L"vbBlue", NULL, BP_GET, VT_I4, 0xff0000}, + {L"vbBoolean", NULL, BP_GET, VT_I2, VT_BOOL}, + {L"vbByte", NULL, BP_GET, VT_I2, VT_UI1}, + {L"vbCancel", NULL, BP_GET, VT_I2, IDCANCEL}, + {L"vbCr", NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbCr}, + {L"vbCritical", NULL, BP_GET, VT_I2, MB_ICONHAND}, + {L"vbCrLf", NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbCrLf}, + {L"vbCurrency", NULL, BP_GET, VT_I2, VT_CY}, + {L"vbCyan", NULL, BP_GET, VT_I4, 0xffff00}, + {L"vbDatabaseCompare", NULL, BP_GET, VT_I2, 2}, + {L"vbDataObject", NULL, BP_GET, VT_I2, VT_UNKNOWN}, + {L"vbDate", NULL, BP_GET, VT_I2, VT_DATE}, + {L"vbDecimal", NULL, BP_GET, VT_I2, VT_DECIMAL}, + {L"vbDefaultButton1", NULL, BP_GET, VT_I2, MB_DEFBUTTON1}, + {L"vbDefaultButton2", NULL, BP_GET, VT_I2, MB_DEFBUTTON2}, + {L"vbDefaultButton3", NULL, BP_GET, VT_I2, MB_DEFBUTTON3}, + {L"vbDefaultButton4", NULL, BP_GET, VT_I2, MB_DEFBUTTON4}, + {L"vbDouble", NULL, BP_GET, VT_I2, VT_R8}, + {L"vbEmpty", NULL, BP_GET, VT_I2, VT_EMPTY}, + {L"vbError", NULL, BP_GET, VT_I2, VT_ERROR}, + {L"vbExclamation", NULL, BP_GET, VT_I2, MB_ICONEXCLAMATION}, + {L"vbFalse", NULL, BP_GET, VT_I2, VARIANT_FALSE}, + {L"vbFirstFourDays", NULL, BP_GET, VT_I2, 2}, + {L"vbFirstFullWeek", NULL, BP_GET, VT_I2, 3}, + {L"vbFirstJan1", NULL, BP_GET, VT_I2, 1}, + {L"vbFormFeed", NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbFormFeed}, + {L"vbFriday", NULL, BP_GET, VT_I2, 6}, + {L"vbGeneralDate", NULL, BP_GET, VT_I2, 0}, + {L"vbGreen", NULL, BP_GET, VT_I4, 0x00ff00}, + {L"vbIgnore", NULL, BP_GET, VT_I2, IDIGNORE}, + {L"vbInformation", NULL, BP_GET, VT_I2, MB_ICONASTERISK}, + {L"vbInteger", NULL, BP_GET, VT_I2, VT_I2}, + {L"vbLf", NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbLf}, + {L"vbLong", NULL, BP_GET, VT_I2, VT_I4}, + {L"vbLongDate", NULL, BP_GET, VT_I2, 1}, + {L"vbLongTime", NULL, BP_GET, VT_I2, 3}, + {L"vbMagenta", NULL, BP_GET, VT_I4, 0xff00ff}, + {L"vbMonday", NULL, BP_GET, VT_I2, 2}, + {L"vbMsgBoxHelpButton", NULL, BP_GET, VT_I4, MB_HELP}, + {L"vbMsgBoxRight", NULL, BP_GET, VT_I4, MB_RIGHT}, + {L"vbMsgBoxRtlReading", NULL, BP_GET, VT_I4, MB_RTLREADING}, + {L"vbMsgBoxSetForeground", NULL, BP_GET, VT_I4, MB_SETFOREGROUND}, + {L"vbNewLine", NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbNewLine}, + {L"vbNo", NULL, BP_GET, VT_I2, IDNO}, + {L"vbNull", NULL, BP_GET, VT_I2, VT_NULL}, + {L"vbNullChar", NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbNullChar}, + {L"vbNullString", NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbNullString}, + {L"vbObject", NULL, BP_GET, VT_I2, VT_DISPATCH}, + {L"vbObjectError", NULL, BP_GET, VT_I4, 0x80040000}, + {L"vbOK", NULL, BP_GET, VT_I2, IDOK}, + {L"vbOKCancel", NULL, BP_GET, VT_I2, MB_OKCANCEL}, + {L"vbOKOnly", NULL, BP_GET, VT_I2, MB_OK}, + {L"vbQuestion", NULL, BP_GET, VT_I2, MB_ICONQUESTION}, + {L"vbRed", NULL, BP_GET, VT_I4, 0x0000ff}, + {L"vbRetry", NULL, BP_GET, VT_I2, IDRETRY}, + {L"vbRetryCancel", NULL, BP_GET, VT_I2, MB_RETRYCANCEL}, + {L"vbSaturday", NULL, BP_GET, VT_I2, 7}, + {L"vbShortDate", NULL, BP_GET, VT_I2, 2}, + {L"vbShortTime", NULL, BP_GET, VT_I2, 4}, + {L"vbSingle", NULL, BP_GET, VT_I2, VT_R4}, + {L"vbString", NULL, BP_GET, VT_I2, VT_BSTR}, + {L"vbSunday", NULL, BP_GET, VT_I2, 1}, + {L"vbSystemModal", NULL, BP_GET, VT_I2, MB_SYSTEMMODAL}, + {L"vbTab", NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbTab}, + {L"vbTextCompare", NULL, BP_GET, VT_I2, 1}, + {L"vbThursday", NULL, BP_GET, VT_I2, 5}, + {L"vbTrue", NULL, BP_GET, VT_I2, VARIANT_TRUE}, + {L"vbTuesday", NULL, BP_GET, VT_I2, 3}, + {L"vbUseDefault", NULL, BP_GET, VT_I2, -2}, + {L"vbUseSystem", NULL, BP_GET, VT_I2, 0}, + {L"vbUseSystemDayOfWeek", NULL, BP_GET, VT_I2, 0}, + {L"vbVariant", NULL, BP_GET, VT_I2, VT_VARIANT}, + {L"vbVerticalTab", NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbVerticalTab}, + {L"vbWednesday", NULL, BP_GET, VT_I2, 4}, + {L"vbWhite", NULL, BP_GET, VT_I4, 0xffffff}, + {L"vbYellow", NULL, BP_GET, VT_I4, 0x00ffff}, + {L"vbYes", NULL, BP_GET, VT_I2, IDYES}, + {L"vbYesNo", NULL, BP_GET, VT_I2, MB_YESNO}, + {L"vbYesNoCancel", NULL, BP_GET, VT_I2, MB_YESNOCANCEL}, + {L"Weekday", Global_Weekday, 0, 1, 2}, + {L"WeekdayName", Global_WeekdayName, 0, 1, 3}, + {L"Year", Global_Year, 0, 1} }; -static HRESULT Err_Description(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT err_string_prop(BSTR *prop, VARIANT *args, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + BSTR str; + HRESULT hres; + + if(!args_cnt) + return return_string(res, *prop ? *prop : L""); + + hres = to_string(args, &str); + if(FAILED(hres)) + return hres; + + SysFreeString(*prop); + *prop = str; + return S_OK; } -static HRESULT Err_HelpContext(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT Err_Description(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + TRACE("\n"); + return err_string_prop(&This->ctx->ei.bstrDescription, args, args_cnt, res); } -static HRESULT Err_HelpFile(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT Err_HelpContext(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + TRACE("\n"); + + if(args_cnt) { + FIXME("setter not implemented\n"); + return E_NOTIMPL; + } + + return return_int(res, This->ctx->ei.dwHelpContext); } -static HRESULT Err_Number(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT Err_HelpFile(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +{ + TRACE("\n"); + return err_string_prop(&This->ctx->ei.bstrHelpFile, args, args_cnt, res); +} + +static HRESULT Err_Number(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { HRESULT hres; TRACE("\n"); - if(!This->desc) - return E_UNEXPECTED; - if(args_cnt) { FIXME("setter not implemented\n"); return E_NOTIMPL; } - hres = This->desc->ctx->err_number; + hres = This->ctx->ei.scode; return return_int(res, HRESULT_FACILITY(hres) == FACILITY_VBS ? HRESULT_CODE(hres) : hres); } -static HRESULT Err_Source(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT Err_Source(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + TRACE("\n"); + return err_string_prop(&This->ctx->ei.bstrSource, args, args_cnt, res); } -static HRESULT Err_Clear(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT Err_Clear(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { TRACE("\n"); - if(!This->desc) - return E_UNEXPECTED; - - This->desc->ctx->err_number = S_OK; + clear_ei(&This->ctx->ei); return S_OK; } -static HRESULT Err_Raise(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +static HRESULT Err_Raise(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + BSTR source = NULL, description = NULL, helpfile = NULL; + int code, helpcontext = 0; + HRESULT hres, error; + + TRACE("%s %u...\n", debugstr_variant(args), args_cnt); + + hres = to_int(args, &code); + if(FAILED(hres)) + return hres; + if(code > 0 && code > 0xffff) + return E_INVALIDARG; + + if(args_cnt >= 2) + hres = to_string(args + 1, &source); + if(args_cnt >= 3 && SUCCEEDED(hres)) + hres = to_string(args + 2, &description); + if(args_cnt >= 4 && SUCCEEDED(hres)) + hres = to_string(args + 3, &helpfile); + if(args_cnt >= 5 && SUCCEEDED(hres)) + hres = to_int(args + 4, &helpcontext); + + if(SUCCEEDED(hres)) { + script_ctx_t *ctx = This->ctx; + + error = (code & ~0xffff) ? map_hres(code) : MAKE_VBSERROR(code); + + if(source) { + if(ctx->ei.bstrSource) SysFreeString(ctx->ei.bstrSource); + ctx->ei.bstrSource = source; + } + if(!ctx->ei.bstrSource) + ctx->ei.bstrSource = get_vbscript_string(VBS_RUNTIME_ERROR); + if(description) { + if(ctx->ei.bstrDescription) SysFreeString(ctx->ei.bstrDescription); + ctx->ei.bstrDescription = description; + } + if(!ctx->ei.bstrDescription) + ctx->ei.bstrDescription = get_vbscript_error_string(error); + if(helpfile) { + if(ctx->ei.bstrHelpFile) SysFreeString(ctx->ei.bstrHelpFile); + ctx->ei.bstrHelpFile = helpfile; + } + if(args_cnt >= 5) + ctx->ei.dwHelpContext = helpcontext; + + ctx->ei.scode = error; + hres = SCRIPT_E_RECORDED; + }else { + SysFreeString(source); + SysFreeString(description); + SysFreeString(helpfile); + } + + return hres; } static const builtin_prop_t err_props[] = { - {DISPID_ERR_DESCRIPTION, Err_Description, BP_GETPUT}, - {DISPID_ERR_HELPCONTEXT, Err_HelpContext, BP_GETPUT}, - {DISPID_ERR_HELPFILE, Err_HelpFile, BP_GETPUT}, - {DISPID_ERR_NUMBER, Err_Number, BP_GETPUT}, - {DISPID_ERR_SOURCE, Err_Source, BP_GETPUT}, - {DISPID_ERR_CLEAR, Err_Clear}, - {DISPID_ERR_RAISE, Err_Raise, 0, 5}, + {NULL, Err_Number, BP_GETPUT}, + {L"Clear", Err_Clear}, + {L"Description", Err_Description, BP_GETPUT}, + {L"HelpContext", Err_HelpContext, BP_GETPUT}, + {L"HelpFile", Err_HelpFile, BP_GETPUT}, + {L"Number", Err_Number, BP_GETPUT}, + {L"Raise", Err_Raise, 0, 1, 5}, + {L"Source", Err_Source, BP_GETPUT} }; -HRESULT init_global(script_ctx_t *ctx) +void detach_global_objects(script_ctx_t *ctx) { - HRESULT hres; - - ctx->global_desc.ctx = ctx; - ctx->global_desc.builtin_prop_cnt = ARRAY_SIZE(global_props); - ctx->global_desc.builtin_props = global_props; - - hres = get_typeinfo(GlobalObj_tid, &ctx->global_desc.typeinfo); - if(FAILED(hres)) - return hres; - - hres = create_vbdisp(&ctx->global_desc, &ctx->global_obj); - if(FAILED(hres)) - return hres; + if(ctx->err_obj) { + ctx->err_obj->ctx = NULL; + IDispatch_Release(&ctx->err_obj->IDispatch_iface); + ctx->err_obj = NULL; + } - hres = create_script_disp(ctx, &ctx->script_obj); - if(FAILED(hres)) - return hres; + if(ctx->global_obj) { + ctx->global_obj->ctx = NULL; + IDispatch_Release(&ctx->global_obj->IDispatch_iface); + ctx->global_obj = NULL; + } +} - ctx->err_desc.ctx = ctx; - ctx->err_desc.builtin_prop_cnt = ARRAY_SIZE(err_props); - ctx->err_desc.builtin_props = err_props; +HRESULT init_global(script_ctx_t *ctx) +{ + HRESULT hres; - hres = get_typeinfo(ErrObj_tid, &ctx->err_desc.typeinfo); + hres = create_builtin_dispatch(ctx, global_props, ARRAY_SIZE(global_props), &ctx->global_obj); if(FAILED(hres)) return hres; - return create_vbdisp(&ctx->err_desc, &ctx->err_obj); + return create_builtin_dispatch(ctx, err_props, ARRAY_SIZE(err_props), &ctx->err_obj); } diff --git a/dll/win32/vbscript/interp.c b/dll/win32/vbscript/interp.c index b46bd01c0fc..80ecc416998 100644 --- a/dll/win32/vbscript/interp.c +++ b/dll/win32/vbscript/interp.c @@ -83,7 +83,7 @@ typedef struct { static BOOL lookup_dynamic_vars(dynamic_var_t *var, const WCHAR *name, ref_t *ref) { while(var) { - if(!strcmpiW(var->name, name)) { + if(!wcsicmp(var->name, name)) { ref->type = var->is_const ? REF_CONST : REF_VAR; ref->u.v = &var->v; return TRUE; @@ -104,18 +104,16 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_ DISPID id; HRESULT hres; - static const WCHAR errW[] = {'e','r','r',0}; - if(invoke_type == VBDISP_LET && (ctx->func->type == FUNC_FUNCTION || ctx->func->type == FUNC_PROPGET || ctx->func->type == FUNC_DEFGET) - && !strcmpiW(name, ctx->func->name)) { + && !wcsicmp(name, ctx->func->name)) { ref->type = REF_VAR; ref->u.v = &ctx->ret_val; return S_OK; } for(i=0; i < ctx->func->var_cnt; i++) { - if(!strcmpiW(ctx->func->vars[i].name, name)) { + if(!wcsicmp(ctx->func->vars[i].name, name)) { ref->type = REF_VAR; ref->u.v = ctx->vars+i; return TRUE; @@ -123,7 +121,7 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_ } for(i=0; i < ctx->func->arg_cnt; i++) { - if(!strcmpiW(ctx->func->args[i].name, name)) { + if(!wcsicmp(ctx->func->args[i].name, name)) { ref->type = REF_VAR; ref->u.v = ctx->args+i; return S_OK; @@ -137,7 +135,7 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_ if(ctx->vbthis) { /* FIXME: Bind such identifier while generating bytecode. */ for(i=0; i < ctx->vbthis->desc->prop_cnt; i++) { - if(!strcmpiW(ctx->vbthis->desc->props[i].name, name)) { + if(!wcsicmp(ctx->vbthis->desc->props[i].name, name)) { ref->type = REF_VAR; ref->u.v = ctx->vbthis->props+i; return S_OK; @@ -168,23 +166,17 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_ return S_OK; for(func = ctx->script->global_funcs; func; func = func->next) { - if(!strcmpiW(func->name, name)) { + if(!wcsicmp(func->name, name)) { ref->type = REF_FUNC; ref->u.f = func; return S_OK; } } - if(!strcmpiW(name, errW)) { - ref->type = REF_OBJ; - ref->u.obj = (IDispatch*)&ctx->script->err_obj->IDispatchEx_iface; - return S_OK; - } - - hres = vbdisp_get_id(ctx->script->global_obj, name, invoke_type, TRUE, &id); + hres = get_builtin_id(ctx->script->global_obj, name, &id); if(SUCCEEDED(hres)) { ref->type = REF_DISP; - ref->u.d.disp = (IDispatch*)&ctx->script->global_obj->IDispatchEx_iface; + ref->u.d.disp = &ctx->script->global_obj->IDispatch_iface; ref->u.d.id = id; return S_OK; } @@ -226,7 +218,7 @@ static HRESULT add_dynamic_var(exec_ctx_t *ctx, const WCHAR *name, if(!new_var) return E_OUTOFMEMORY; - size = (strlenW(name)+1)*sizeof(WCHAR); + size = (lstrlenW(name)+1)*sizeof(WCHAR); str = heap_pool_alloc(heap, size); if(!str) return E_OUTOFMEMORY; @@ -247,6 +239,14 @@ static HRESULT add_dynamic_var(exec_ctx_t *ctx, const WCHAR *name, return S_OK; } +void clear_ei(EXCEPINFO *ei) +{ + SysFreeString(ei->bstrSource); + SysFreeString(ei->bstrDescription); + SysFreeString(ei->bstrHelpFile); + memset(ei, 0, sizeof(*ei)); +} + static inline VARIANT *stack_pop(exec_ctx_t *ctx) { assert(ctx->top); @@ -319,7 +319,7 @@ static HRESULT stack_pop_val(exec_ctx_t *ctx, variant_val_t *r) HRESULT hres; hres = get_disp_value(ctx->script, V_DISPATCH(r->v), &r->store); - if(r->owned) + if(r->owned && V_DISPATCH(r->v)) IDispatch_Release(V_DISPATCH(r->v)); if(FAILED(hres)) return hres; @@ -350,7 +350,8 @@ static HRESULT stack_assume_val(exec_ctx_t *ctx, unsigned n) disp = V_DISPATCH(v); hres = get_disp_value(ctx->script, disp, v); - IDispatch_Release(disp); + if(disp) + IDispatch_Release(disp); if(FAILED(hres)) return hres; } @@ -580,7 +581,7 @@ static HRESULT do_icall(exec_ctx_t *ctx, VARIANT *res) break; case REF_FUNC: vbstack_to_dp(ctx, arg_cnt, FALSE, &dp); - hres = exec_script(ctx->script, ref.u.f, NULL, &dp, res); + hres = exec_script(ctx->script, FALSE, ref.u.f, NULL, &dp, res); if(FAILED(hres)) return hres; break; @@ -688,23 +689,27 @@ static HRESULT interp_mcallv(exec_ctx_t *ctx) static HRESULT assign_value(exec_ctx_t *ctx, VARIANT *dst, VARIANT *src, WORD flags) { + VARIANT value; HRESULT hres; - hres = VariantCopyInd(dst, src); + V_VT(&value) = VT_EMPTY; + hres = VariantCopyInd(&value, src); if(FAILED(hres)) return hres; - if(V_VT(dst) == VT_DISPATCH && !(flags & DISPATCH_PROPERTYPUTREF)) { - VARIANT value; + if(V_VT(&value) == VT_DISPATCH && !(flags & DISPATCH_PROPERTYPUTREF)) { + IDispatch *disp = V_DISPATCH(&value); - hres = get_disp_value(ctx->script, V_DISPATCH(dst), &value); - IDispatch_Release(V_DISPATCH(dst)); + V_VT(&value) = VT_EMPTY; + hres = get_disp_value(ctx->script, disp, &value); + if(disp) + IDispatch_Release(disp); if(FAILED(hres)) return hres; - - *dst = value; } + VariantClear(dst); + *dst = value; return S_OK; } @@ -988,7 +993,7 @@ static HRESULT interp_new(exec_ctx_t *ctx) TRACE("%s\n", debugstr_w(arg)); - if(!strcmpiW(arg, regexpW)) { + if(!wcsicmp(arg, regexpW)) { V_VT(&v) = VT_DISPATCH; hres = create_regexp(&V_DISPATCH(&v)); if(FAILED(hres)) @@ -998,7 +1003,7 @@ static HRESULT interp_new(exec_ctx_t *ctx) } for(class_desc = ctx->script->classes; class_desc; class_desc = class_desc->next) { - if(!strcmpiW(class_desc->name, arg)) + if(!wcsicmp(class_desc->name, arg)) break; } if(!class_desc) { @@ -1258,6 +1263,30 @@ static HRESULT interp_ret(exec_ctx_t *ctx) return S_OK; } +static HRESULT interp_retval(exec_ctx_t *ctx) +{ + variant_val_t val; + HRESULT hres; + + TRACE("\n"); + + hres = stack_pop_val(ctx, &val); + if(FAILED(hres)) + return hres; + + if(val.owned) { + VariantClear(&ctx->ret_val); + ctx->ret_val = *val.v; + } + else { + hres = VariantCopy(&ctx->ret_val, val.v); + if(FAILED(hres)) + return hres; + } + + return S_OK; +} + static HRESULT interp_stop(exec_ctx_t *ctx) { WARN("\n"); @@ -1297,7 +1326,7 @@ static HRESULT interp_errmode(exec_ctx_t *ctx) TRACE("%d\n", err_mode); ctx->resume_next = err_mode; - ctx->script->err_number = S_OK; + clear_ei(&ctx->script->ei); return S_OK; } @@ -1315,27 +1344,20 @@ static HRESULT interp_string(exec_ctx_t *ctx) return stack_push(ctx, &v); } -static HRESULT interp_long(exec_ctx_t *ctx) +static HRESULT interp_int(exec_ctx_t *ctx) { const LONG arg = ctx->instr->arg1.lng; VARIANT v; TRACE("%d\n", arg); - V_VT(&v) = VT_I4; - V_I4(&v) = arg; - return stack_push(ctx, &v); -} - -static HRESULT interp_short(exec_ctx_t *ctx) -{ - const LONG arg = ctx->instr->arg1.lng; - VARIANT v; - - TRACE("%d\n", arg); - - V_VT(&v) = VT_I2; - V_I2(&v) = arg; + if(arg == (INT16)arg) { + V_VT(&v) = VT_I2; + V_I2(&v) = arg; + }else { + V_VT(&v) = VT_I4; + V_I4(&v) = arg; + } return stack_push(ctx, &v); } @@ -2061,7 +2083,7 @@ static void release_exec(exec_ctx_t *ctx) heap_free(ctx->stack); } -HRESULT exec_script(script_ctx_t *ctx, function_t *func, vbdisp_t *vbthis, DISPPARAMS *dp, VARIANT *res) +HRESULT exec_script(script_ctx_t *ctx, BOOL extern_caller, function_t *func, vbdisp_t *vbthis, DISPPARAMS *dp, VARIANT *res) { exec_ctx_t exec = {func->code_ctx}; vbsop_t op; @@ -2123,6 +2145,9 @@ HRESULT exec_script(script_ctx_t *ctx, function_t *func, vbdisp_t *vbthis, DISPP return E_OUTOFMEMORY; } + if(extern_caller) + IActiveScriptSite_OnEnterScript(ctx->site); + if(vbthis) { exec.this_obj = (IDispatch*)&vbthis->IDispatchEx_iface; exec.vbthis = vbthis; @@ -2141,7 +2166,15 @@ HRESULT exec_script(script_ctx_t *ctx, function_t *func, vbdisp_t *vbthis, DISPP op = exec.instr->op; hres = op_funcs[op](&exec); if(FAILED(hres)) { - ctx->err_number = hres = map_hres(hres); + if(hres != SCRIPT_E_RECORDED) { + clear_ei(&ctx->ei); + + ctx->ei.scode = hres = map_hres(hres); + ctx->ei.bstrSource = get_vbscript_string(VBS_RUNTIME_ERROR); + ctx->ei.bstrDescription = get_vbscript_error_string(hres); + }else { + hres = ctx->ei.scode; + } if(exec.resume_next) { unsigned stack_off; @@ -2186,8 +2219,15 @@ HRESULT exec_script(script_ctx_t *ctx, function_t *func, vbdisp_t *vbthis, DISPP } assert(!exec.top); - if(func->type != FUNC_FUNCTION && func->type != FUNC_PROPGET && func->type != FUNC_DEFGET) - assert(V_VT(&exec.ret_val) == VT_EMPTY); + + if(extern_caller) { + IActiveScriptSite_OnLeaveScript(ctx->site); + if(FAILED(hres)) { + if(!ctx->ei.scode) + ctx->ei.scode = hres; + hres = report_script_error(ctx); + } + } if(SUCCEEDED(hres) && res) { *res = exec.ret_val; diff --git a/dll/win32/vbscript/lex.c b/dll/win32/vbscript/lex.c index 571854db58e..26b3d45a727 100644 --- a/dll/win32/vbscript/lex.c +++ b/dll/win32/vbscript/lex.c @@ -16,11 +16,13 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" -#include "wine/port.h" - +#ifdef __REACTOS__ +#include <wine/config.h> +#include <wine/port.h> +#endif #include <assert.h> #include <limits.h> +#include <math.h> #include "vbscript.h" #include "parse.h" @@ -153,17 +155,17 @@ static const struct { static inline BOOL is_identifier_char(WCHAR c) { - return isalnumW(c) || c == '_'; + return iswalnum(c) || c == '_'; } -static int check_keyword(parser_ctx_t *ctx, const WCHAR *word) +static int check_keyword(parser_ctx_t *ctx, const WCHAR *word, const WCHAR **lval) { const WCHAR *p1 = ctx->ptr; const WCHAR *p2 = word; WCHAR c; while(p1 < ctx->end && *p2) { - c = tolowerW(*p1); + c = towlower(*p1); if(c != *p2) return c - *p2; p1++; @@ -174,17 +176,18 @@ static int check_keyword(parser_ctx_t *ctx, const WCHAR *word) return 1; ctx->ptr = p1; + *lval = word; return 0; } -static int check_keywords(parser_ctx_t *ctx) +static int check_keywords(parser_ctx_t *ctx, const WCHAR **lval) { int min = 0, max = ARRAY_SIZE(keywords)-1, r, i; while(min <= max) { i = (min+max)/2; - r = check_keyword(ctx, keywords[i].word); + r = check_keyword(ctx, keywords[i].word, lval); if(!r) return keywords[i].token; @@ -224,7 +227,7 @@ static int parse_string_literal(parser_ctx_t *ctx, const WCHAR **ret) int len = 0; while(ctx->ptr < ctx->end) { - if(*ctx->ptr == '\n') { + if(*ctx->ptr == '\n' || *ctx->ptr == '\r') { FIXME("newline inside string literal\n"); return 0; } @@ -270,7 +273,7 @@ static int parse_numeric_literal(parser_ctx_t *ctx, void **ret) if(*ctx->ptr == '0' && !('0' <= ctx->ptr[1] && ctx->ptr[1] <= '9') && ctx->ptr[1] != '.') return *ctx->ptr++; - while(ctx->ptr < ctx->end && isdigitW(*ctx->ptr)) { + while(ctx->ptr < ctx->end && iswdigit(*ctx->ptr)) { hlp = d*10 + *(ctx->ptr++) - '0'; if(d>MAXLONGLONG/10 || hlp<0) { exp++; @@ -279,7 +282,7 @@ static int parse_numeric_literal(parser_ctx_t *ctx, void **ret) else d = hlp; } - while(ctx->ptr < ctx->end && isdigitW(*ctx->ptr)) { + while(ctx->ptr < ctx->end && iswdigit(*ctx->ptr)) { exp++; ctx->ptr++; } @@ -288,7 +291,7 @@ static int parse_numeric_literal(parser_ctx_t *ctx, void **ret) use_int = FALSE; ctx->ptr++; - while(ctx->ptr < ctx->end && isdigitW(*ctx->ptr)) { + while(ctx->ptr < ctx->end && iswdigit(*ctx->ptr)) { hlp = d*10 + *(ctx->ptr++) - '0'; if(d>MAXLONGLONG/10 || hlp<0) break; @@ -296,19 +299,22 @@ static int parse_numeric_literal(parser_ctx_t *ctx, void **ret) d = hlp; exp--; } - while(ctx->ptr < ctx->end && isdigitW(*ctx->ptr)) + while(ctx->ptr < ctx->end && iswdigit(*ctx->ptr)) ctx->ptr++; } if(*ctx->ptr == 'e' || *ctx->ptr == 'E') { int e = 0, sign = 1; - if(*++ctx->ptr == '-') { + ctx->ptr++; + if(*ctx->ptr == '-') { ctx->ptr++; sign = -1; + }else if(*ctx->ptr == '+') { + ctx->ptr++; } - if(!isdigitW(*ctx->ptr)) { + if(!iswdigit(*ctx->ptr)) { FIXME("Invalid numeric literal\n"); return 0; } @@ -319,7 +325,7 @@ static int parse_numeric_literal(parser_ctx_t *ctx, void **ret) e = e*10 + *(ctx->ptr++) - '0'; if(sign == -1 && -e+exp < -(INT_MAX/100)) { /* The literal will be rounded to 0 anyway. */ - while(isdigitW(*ctx->ptr)) + while(iswdigit(*ctx->ptr)) ctx->ptr++; *(double*)ret = 0; return tDouble; @@ -329,15 +335,14 @@ static int parse_numeric_literal(parser_ctx_t *ctx, void **ret) FIXME("Invalid numeric literal\n"); return 0; } - } while(isdigitW(*ctx->ptr)); + } while(iswdigit(*ctx->ptr)); exp += sign*e; } if(use_int && (LONG)d == d) { - LONG l = d; - *(LONG*)ret = l; - return (short)l == l ? tShort : tLong; + *(LONG*)ret = d; + return tInt; } r = exp>=0 ? d*pow(10, exp) : d/pow(10, -exp); @@ -378,7 +383,7 @@ static int parse_hex_literal(parser_ctx_t *ctx, LONG *ret) ctx->ptr++; *ret = l; - return (short)l == l ? tShort : tLong; + return tInt; } static void skip_spaces(parser_ctx_t *ctx) @@ -390,7 +395,7 @@ static void skip_spaces(parser_ctx_t *ctx) static int comment_line(parser_ctx_t *ctx) { static const WCHAR newlineW[] = {'\n','\r',0}; - ctx->ptr = strpbrkW(ctx->ptr, newlineW); + ctx->ptr = wcspbrk(ctx->ptr, newlineW); if(ctx->ptr) ctx->ptr++; else @@ -411,8 +416,8 @@ static int parse_next_token(void *lval, parser_ctx_t *ctx) if('0' <= c && c <= '9') return parse_numeric_literal(ctx, lval); - if(isalphaW(c)) { - int ret = check_keywords(ctx); + if(iswalpha(c)) { + int ret = check_keywords(ctx, lval); if(!ret) return parse_identifier(ctx, lval); if(ret != tREM) @@ -492,15 +497,24 @@ int parser_lex(void *lval, parser_ctx_t *ctx) { int ret; + if (ctx->last_token == tEXPRESSION) + { + ctx->last_token = tNL; + return tEXPRESSION; + } + while(1) { ret = parse_next_token(lval, ctx); if(ret == '_') { skip_spaces(ctx); - if(*ctx->ptr != '\n') { + if(*ctx->ptr != '\n' && *ctx->ptr != '\r') { FIXME("'_' not followed by newline\n"); return 0; } - ctx->ptr++; + if(*ctx->ptr == '\r') + ctx->ptr++; + if(*ctx->ptr == '\n') + ctx->ptr++; continue; } if(ret != tNL || ctx->last_token != tNL) diff --git a/dll/win32/vbscript/parse.h b/dll/win32/vbscript/parse.h index 1fc2650748e..6e5188c8c5e 100644 --- a/dll/win32/vbscript/parse.h +++ b/dll/win32/vbscript/parse.h @@ -34,6 +34,7 @@ typedef enum { EXPR_GTEQ, EXPR_IDIV, EXPR_IMP, + EXPR_INT, EXPR_IS, EXPR_LT, EXPR_LTEQ, @@ -51,8 +52,6 @@ typedef enum { EXPR_OR, EXPR_STRING, EXPR_SUB, - EXPR_ULONG, - EXPR_USHORT, EXPR_XOR } expression_type_t; @@ -121,7 +120,8 @@ typedef enum { STAT_STOP, STAT_UNTIL, STAT_WHILE, - STAT_WHILELOOP + STAT_WHILELOOP, + STAT_RETVAL } statement_type_t; typedef struct _statement_t { @@ -251,6 +251,11 @@ typedef struct { case_clausule_t *case_clausules; } select_statement_t; +typedef struct { + statement_t stat; + expression_t *expr; +} retval_statement_t; + typedef struct { const WCHAR *code; const WCHAR *ptr; @@ -271,7 +276,7 @@ typedef struct { heap_pool_t heap; } parser_ctx_t; -HRESULT parse_script(parser_ctx_t*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN; +HRESULT parse_script(parser_ctx_t*,const WCHAR*,const WCHAR*,DWORD) DECLSPEC_HIDDEN; void parser_release(parser_ctx_t*) DECLSPEC_HIDDEN; int parser_lex(void*,parser_ctx_t*) DECLSPEC_HIDDEN; void *parser_alloc(parser_ctx_t*,size_t) DECLSPEC_HIDDEN; diff --git a/dll/win32/vbscript/parser.tab.c b/dll/win32/vbscript/parser.tab.c index af2c0448591..cc702c598a9 100644 --- a/dll/win32/vbscript/parser.tab.c +++ b/dll/win32/vbscript/parser.tab.c @@ -1,8 +1,9 @@ -/* A Bison parser, made by GNU Bison 3.0. */ +/* A Bison parser, made by GNU Bison 3.4.1. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,11 +41,14 @@ define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ +/* Undocumented macros, especially those whose name start with YY_, + are private implementation details. Do not rely on them. */ + /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.0" +#define YYBISON_VERSION "3.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -67,8 +71,8 @@ #define yynerrs parser_nerrs -/* Copy the first part of user declarations. */ -#line 19 "parser.y" /* yacc.c:339 */ +/* First part of user prologue. */ +#line 19 "parser.y" #include "vbscript.h" @@ -81,6 +85,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(vbscript); static int parser_error(parser_ctx_t *,const char*); static void parse_complete(parser_ctx_t*,BOOL); +static void handle_isexpression_script(parser_ctx_t *ctx, expression_t *expr); static void source_add_statement(parser_ctx_t*,statement_t*); static void source_add_class(parser_ctx_t*,class_decl_t*); @@ -124,21 +129,23 @@ static class_decl_t *add_dim_prop(parser_ctx_t*,class_decl_t*,dim_decl_t*,unsign static statement_t *link_statements(statement_t*,statement_t*); -static const WCHAR propertyW[] = {'p','r','o','p','e','r','t','y',0}; - #define STORAGE_IS_PRIVATE 1 #define STORAGE_IS_DEFAULT 2 #define CHECK_ERROR if(((parser_ctx_t*)ctx)->hres != S_OK) YYABORT -#line 136 "parser.tab.c" /* yacc.c:339 */ +#line 139 "parser.tab.c" -# ifndef YY_NULL -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULL nullptr +# ifndef YY_NULLPTR +# if defined __cplusplus +# if 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif # else -# define YY_NULL 0 +# define YY_NULLPTR ((void*)0) # endif # endif @@ -150,8 +157,8 @@ static const WCHAR propertyW[] = {'p','r','o','p','e','r','t','y',0}; # define YYERROR_VERBOSE 0 #endif -/* In a future release of Bison, this section will be replaced - by #include "parser.tab.h". */ +/* Use api.header.include to #include this header + instead of duplicating it here. */ #ifndef YY_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_VBSCRIPT_PARSER_TAB_H_INCLUDED # define YY_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_VBSCRIPT_PARSER_TAB_H_INCLUDED /* Debug traces. */ @@ -167,83 +174,82 @@ extern int parser_debug; # define YYTOKENTYPE enum yytokentype { - tEOF = 258, - tNL = 259, - tREM = 260, + tEXPRESSION = 258, + tEOF = 259, + tNL = 260, tEMPTYBRACKETS = 261, - tTRUE = 262, - tFALSE = 263, - tNOT = 264, - tAND = 265, - tOR = 266, - tXOR = 267, - tEQV = 268, - tIMP = 269, - tNEQ = 270, - tIS = 271, - tLTEQ = 272, - tGTEQ = 273, - tMOD = 274, - tCALL = 275, - tDIM = 276, - tSUB = 277, - tFUNCTION = 278, - tPROPERTY = 279, - tGET = 280, - tLET = 281, - tCONST = 282, - tIF = 283, - tELSE = 284, - tELSEIF = 285, - tEND = 286, - tTHEN = 287, - tEXIT = 288, - tWHILE = 289, - tWEND = 290, - tDO = 291, - tLOOP = 292, - tUNTIL = 293, - tFOR = 294, - tTO = 295, - tSTEP = 296, - tEACH = 297, - tIN = 298, - tSELECT = 299, - tCASE = 300, - tBYREF = 301, - tBYVAL = 302, - tOPTION = 303, - tEXPLICIT = 304, - tSTOP = 305, - tNOTHING = 306, - tEMPTY = 307, - tNULL = 308, - tCLASS = 309, - tSET = 310, - tNEW = 311, - tPUBLIC = 312, - tPRIVATE = 313, - tDEFAULT = 314, - tME = 315, - tERROR = 316, - tNEXT = 317, - tON = 318, - tRESUME = 319, - tGOTO = 320, - tIdentifier = 321, - tString = 322, - tLong = 323, - tShort = 324, + tLTEQ = 262, + tGTEQ = 263, + tNEQ = 264, + tSTOP = 265, + tME = 266, + tREM = 267, + tTRUE = 268, + tFALSE = 269, + tNOT = 270, + tAND = 271, + tOR = 272, + tXOR = 273, + tEQV = 274, + tIMP = 275, + tIS = 276, + tMOD = 277, + tCALL = 278, + tDIM = 279, + tSUB = 280, + tFUNCTION = 281, + tGET = 282, + tLET = 283, + tCONST = 284, + tIF = 285, + tELSE = 286, + tELSEIF = 287, + tEND = 288, + tTHEN = 289, + tEXIT = 290, + tWHILE = 291, + tWEND = 292, + tDO = 293, + tLOOP = 294, + tUNTIL = 295, + tFOR = 296, + tTO = 297, + tEACH = 298, + tIN = 299, + tSELECT = 300, + tCASE = 301, + tBYREF = 302, + tBYVAL = 303, + tOPTION = 304, + tNOTHING = 305, + tEMPTY = 306, + tNULL = 307, + tCLASS = 308, + tSET = 309, + tNEW = 310, + tPUBLIC = 311, + tPRIVATE = 312, + tNEXT = 313, + tON = 314, + tRESUME = 315, + tGOTO = 316, + tIdentifier = 317, + tString = 318, + tDEFAULT = 319, + tERROR = 320, + tEXPLICIT = 321, + tPROPERTY = 322, + tSTEP = 323, + tInt = 324, tDouble = 325 }; #endif /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; union YYSTYPE { -#line 88 "parser.y" /* yacc.c:355 */ +#line 87 "parser.y" const WCHAR *string; statement_t *statement; @@ -258,12 +264,14 @@ union YYSTYPE const_decl_t *const_decl; case_clausule_t *case_clausule; unsigned uint; - LONG lng; + LONG integer; BOOL boolean; double dbl; -#line 266 "parser.tab.c" /* yacc.c:355 */ +#line 272 "parser.tab.c" + }; +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif @@ -274,9 +282,7 @@ int parser_parse (parser_ctx_t *ctx); #endif /* !YY_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_VBSCRIPT_PARSER_TAB_H_INCLUDED */ -/* Copy the second part of user declarations. */ -#line 280 "parser.tab.c" /* yacc.c:358 */ #ifdef short # undef short @@ -297,13 +303,13 @@ typedef signed char yytype_int8; #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else -typedef unsigned short int yytype_uint16; +typedef unsigned short yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else -typedef short int yytype_int16; +typedef short yytype_int16; #endif #ifndef YYSIZE_T @@ -315,7 +321,7 @@ typedef short int yytype_int16; # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else -# define YYSIZE_T unsigned int +# define YYSIZE_T unsigned # endif #endif @@ -333,14 +339,24 @@ typedef short int yytype_int16; # endif #endif -#ifndef __attribute__ -/* This feature is available in gcc versions 2.5 and later. */ -# if (! defined __GNUC__ || __GNUC__ < 2 \ - || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)) -# define __attribute__(Spec) /* empty */ +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ # endif #endif +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(E) ((void) (E)) @@ -348,7 +364,7 @@ typedef short int yytype_int16; # define YYUSE(E) /* empty */ #endif -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ @@ -368,6 +384,8 @@ typedef short int yytype_int16; #endif +#define YY_ASSERT(E) ((void) (0 && (E))) + #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -497,29 +515,29 @@ union yyalloc #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 5 +#define YYFINAL 48 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 944 +#define YYLAST 1153 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 87 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 60 +#define YYNNTS 63 /* YYNRULES -- Number of rules. */ -#define YYNRULES 169 +#define YYNRULES 232 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 343 +#define YYNSTATES 405 -/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned - by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 325 +/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, with out-of-bounds checking. */ #define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, without out-of-bounds checking. */ + as returned by yylex. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -561,23 +579,30 @@ static const yytype_uint8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 147, 147, 150, 151, 153, 155, 156, 159, 160, - 163, 164, 167, 170, 171, 172, 173, 174, 177, 178, - 179, 181, 182, 183, 185, 188, 191, 192, 193, 194, - 195, 196, 197, 198, 200, 201, 202, 203, 204, 206, - 208, 212, 213, 216, 217, 220, 221, 222, 225, 226, - 229, 230, 233, 236, 237, 240, 241, 244, 245, 248, - 250, 251, 254, 256, 259, 260, 263, 264, 267, 271, - 272, 275, 276, 277, 281, 282, 285, 286, 289, 290, - 291, 293, 295, 298, 299, 302, 303, 306, 307, 310, - 311, 314, 315, 318, 319, 322, 323, 326, 327, 328, - 329, 330, 331, 332, 333, 336, 337, 340, 341, 342, - 345, 346, 349, 350, 354, 355, 357, 361, 362, 365, - 366, 367, 368, 371, 372, 375, 376, 377, 378, 379, - 380, 381, 384, 385, 386, 387, 390, 391, 392, 395, - 396, 399, 402, 403, 405, 407, 408, 411, 413, 415, - 419, 421, 425, 426, 429, 430, 431, 434, 435, 438, - 439, 442, 443, 444, 448, 449, 453, 454, 455, 456 + 0, 148, 148, 149, 152, 153, 156, 157, 158, 161, + 162, 165, 166, 167, 170, 171, 174, 175, 178, 181, + 182, 183, 184, 185, 188, 189, 190, 192, 193, 194, + 196, 199, 202, 203, 204, 205, 206, 207, 208, 209, + 211, 212, 213, 214, 215, 217, 219, 223, 224, 227, + 228, 231, 232, 233, 236, 237, 240, 241, 244, 247, + 248, 251, 252, 255, 256, 259, 261, 262, 266, 267, + 270, 271, 274, 275, 278, 282, 283, 286, 287, 288, + 292, 293, 296, 297, 300, 301, 302, 305, 306, 309, + 310, 313, 314, 317, 318, 321, 322, 325, 326, 329, + 330, 333, 334, 337, 338, 339, 340, 341, 342, 343, + 344, 347, 348, 351, 352, 353, 356, 357, 360, 361, + 365, 366, 368, 372, 373, 376, 377, 378, 379, 380, + 383, 384, 387, 388, 389, 390, 391, 392, 393, 396, + 397, 398, 401, 402, 405, 406, 409, 412, 413, 414, + 416, 418, 420, 421, 422, 423, 426, 428, 430, 434, + 436, 440, 441, 444, 445, 446, 449, 450, 453, 454, + 457, 458, 459, 463, 464, 465, 466, 467, 468, 472, + 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, + 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, + 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, + 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, + 513, 514, 515, 516, 517, 518, 519, 520, 521, 525, + 526, 527, 528 }; #endif @@ -586,23 +611,24 @@ static const yytype_uint16 yyrline[] = First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "$end", "error", "$undefined", "tEOF", "tNL", "tREM", "tEMPTYBRACKETS", - "tTRUE", "tFALSE", "tNOT", "tAND", "tOR", "tXOR", "tEQV", "tIMP", "tNEQ", - "tIS", "tLTEQ", "tGTEQ", "tMOD", "tCALL", "tDIM", "tSUB", "tFUNCTION", - "tPROPERTY", "tGET", "tLET", "tCONST", "tIF", "tELSE", "tELSEIF", "tEND", - "tTHEN", "tEXIT", "tWHILE", "tWEND", "tDO", "tLOOP", "tUNTIL", "tFOR", - "tTO", "tSTEP", "tEACH", "tIN", "tSELECT", "tCASE", "tBYREF", "tBYVAL", - "tOPTION", "tEXPLICIT", "tSTOP", "tNOTHING", "tEMPTY", "tNULL", "tCLASS", - "tSET", "tNEW", "tPUBLIC", "tPRIVATE", "tDEFAULT", "tME", "tERROR", - "tNEXT", "tON", "tRESUME", "tGOTO", "tIdentifier", "tString", "tLong", - "tShort", "tDouble", "':'", "'='", "'0'", "'.'", "','", "'('", "')'", - "'-'", "'>'", "'<'", "'&'", "'+'", "'\\\\'", "'*'", "'/'", "'^'", - "$accept", "Program", "OptionExplicit_opt", "SourceElements", - "StatementsNl_opt", "StatementsNl", "StatementNl", "Statement", - "SimpleStatement", "MemberExpression", "DimDeclList", "DimDecl", - "DimList", "ConstDeclList", "ConstDecl", "ConstExpression", "DoType", - "Step_opt", "IfStatement", "EndIf_opt", "ElseIfs_opt", "ElseIfs", - "ElseIf", "Else_opt", "CaseClausules", "Arguments_opt", + "$end", "error", "$undefined", "tEXPRESSION", "tEOF", "tNL", + "tEMPTYBRACKETS", "tLTEQ", "tGTEQ", "tNEQ", "tSTOP", "tME", "tREM", + "tTRUE", "tFALSE", "tNOT", "tAND", "tOR", "tXOR", "tEQV", "tIMP", "tIS", + "tMOD", "tCALL", "tDIM", "tSUB", "tFUNCTION", "tGET", "tLET", "tCONST", + "tIF", "tELSE", "tELSEIF", "tEND", "tTHEN", "tEXIT", "tWHILE", "tWEND", + "tDO", "tLOOP", "tUNTIL", "tFOR", "tTO", "tEACH", "tIN", "tSELECT", + "tCASE", "tBYREF", "tBYVAL", "tOPTION", "tNOTHING", "tEMPTY", "tNULL", + "tCLASS", "tSET", "tNEW", "tPUBLIC", "tPRIVATE", "tNEXT", "tON", + "tRESUME", "tGOTO", "tIdentifier", "tString", "tDEFAULT", "tERROR", + "tEXPLICIT", "tPROPERTY", "tSTEP", "tInt", "tDouble", "':'", "'='", + "'0'", "'.'", "','", "'('", "')'", "'-'", "'>'", "'<'", "'&'", "'+'", + "'\\\\'", "'*'", "'/'", "'^'", "$accept", "Program", + "OptionExplicit_opt", "SourceElements", "ExpressionNl_opt", + "BodyStatements", "StatementsNl_opt", "StatementsNl", "StatementNl", + "Statement", "SimpleStatement", "MemberExpression", "DimDeclList", + "DimDecl", "DimList", "ConstDeclList", "ConstDecl", "ConstExpression", + "DoType", "Step_opt", "IfStatement", "EndIf_opt", "ElseIfs_opt", + "ElseIfs", "ElseIf", "Else_opt", "CaseClausules", "Arguments_opt", "ArgumentList_opt", "ArgumentList", "EmptyBrackets_opt", "ExpressionList", "Expression", "EqvExpression", "XorExpression", "OrExpression", "AndExpression", "NotExpression", "EqualityExpression", @@ -612,7 +638,7 @@ static const char *const yytname[] = "NumericLiteralExpression", "IntegerValue", "PrimaryExpression", "ClassDeclaration", "ClassBody", "PropertyDecl", "FunctionDecl", "Storage_opt", "Storage", "ArgumentsDecl_opt", "ArgumentDeclList", - "ArgumentDecl", "Identifier", "StSep", YY_NULL + "ArgumentDecl", "Identifier", "DotIdentifier", "StSep", YY_NULLPTR }; #endif @@ -633,12 +659,12 @@ static const yytype_uint16 yytoknum[] = }; # endif -#define YYPACT_NINF -205 +#define YYPACT_NINF -294 #define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-205))) + (!!((Yystate) == (-294))) -#define YYTABLE_NINF -153 +#define YYTABLE_NINF -162 #define yytable_value_is_error(Yytable_value) \ 0 @@ -647,41 +673,47 @@ static const yytype_uint16 yytoknum[] = STATE-NUM. */ static const yytype_int16 yypact[] = { - -12, -8, 47, -205, 22, -205, 346, 22, 22, -205, - -205, 34, 35, -205, 35, 537, 134, 537, 12, 32, - 60, -205, 35, 34, -10, -205, -205, 65, -205, 639, - 537, -205, 57, 2, 427, -205, 85, -205, -205, -205, - 109, -205, -205, -205, -205, 4, -205, 33, 5, -205, - 46, 81, -205, -205, 537, -205, -205, -205, 35, -205, - -205, -205, -205, -205, 571, 4, 16, 126, 155, 160, - 168, -205, 37, 117, 29, 181, 119, 79, 130, -205, - 85, -205, -205, -205, -205, -205, -205, -205, 18, -205, - -205, 537, 680, 35, 146, 537, 22, 4, -205, 121, - -205, 13, -205, 639, -205, 457, 457, 147, -205, -205, - 77, 0, 35, 35, 35, 457, 148, -205, 35, -205, - 111, 35, 601, -205, -205, -205, -205, 537, 387, 537, - 537, 537, 537, 571, 571, 571, 571, 571, 571, 571, - 571, 571, 571, 571, 571, 571, 571, 571, 733, 18, - 183, -205, 639, 178, 537, 18, 8, 152, 165, 156, - -205, -205, -205, 151, 1, 537, 457, -205, 6, 6, - -205, -205, -205, -205, 154, 157, -205, 136, -205, -205, - 126, 639, 143, 155, 160, 168, -205, 117, 117, 117, - 117, 117, 117, 117, 29, 181, 181, 119, 79, 130, - 130, -205, 198, 680, 95, -205, 537, 28, 189, 35, - 204, 22, 22, 96, 170, 537, -205, -205, -205, 223, - -205, -3, -205, 22, 22, -205, 111, -205, 210, 868, - 214, -205, -205, 212, 537, 18, 537, 507, 221, 22, - 199, 8, 8, 70, 22, 223, 35, 35, 177, 180, - 253, 774, 774, -205, 537, 231, -205, 210, 230, -205, - -205, 223, 815, 71, 22, 22, 17, 219, 8, 22, - -205, -205, 201, 202, 206, 8, 253, 253, -205, -3, - -205, 234, 239, 19, 269, 243, -205, -205, 213, 537, - 22, 868, 639, 537, -205, -205, -205, 6, 200, 203, - -205, -205, -205, -205, 255, 257, 274, 774, 254, -205, - 223, 815, -205, 189, -205, 22, -3, -3, -205, -205, - 639, -205, -205, 222, -205, 774, 216, 220, -205, -205, - 250, 22, 22, 259, 774, 774, -205, 267, 268, 266, - 278, -205, -205 + 34, 617, -19, 50, -294, -294, -294, -294, 617, -294, + -294, -294, 166, -294, -294, -294, -294, -294, -294, -294, + -294, -294, -294, 617, 660, 660, 30, 2, 16, 43, + 96, 51, 111, -294, 37, 53, -17, 110, 100, 41, + 65, -294, 119, -294, -294, -294, -294, 15, -294, 466, + -294, -294, 19, -294, -294, -294, -294, 545, -294, -294, + -294, 617, 617, 617, 617, 617, 660, 660, 660, 660, + 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, + 660, 1085, 15, 15, -294, -294, -294, 368, 166, 166, + 617, 117, 617, 20, 107, 163, 166, 368, 126, -294, + 149, 721, -294, 212, 152, 391, -294, 119, -294, -294, + 131, -294, -294, 545, 147, -8, 43, 96, 51, 111, + -294, 53, 53, 53, 53, 53, 53, 53, -17, 110, + 110, 100, 41, 65, 65, -294, -294, -294, -294, -294, + -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, + -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, + -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, + -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, + -294, -294, -294, -294, -294, -294, -294, -294, -294, 2, + -294, 154, 11, -294, 160, 164, 18, -294, -294, -294, + -294, -294, 9, -294, -294, 617, 771, 166, 169, 617, + 15, 2, -294, 144, -294, -294, 721, 545, 172, -294, + -294, -32, 166, 166, -294, -294, 545, 171, 166, -294, + 68, 166, 116, 516, 821, 9, 199, -294, 721, 202, + 617, 9, 82, 175, 190, 176, -294, 4, 617, 13, + 13, -294, -294, -294, -294, 173, 177, -294, -16, -294, + -294, 721, 66, 216, 771, 142, -294, 617, 104, 211, + 166, 227, 15, 15, 85, 201, 617, -294, -294, 241, + 97, -294, 15, 15, -294, 68, -294, 234, 1021, 237, + -294, -294, 230, 617, 9, 617, 588, 238, 15, 221, + 82, 82, -5, 15, 241, 166, 166, 200, 203, 270, + 871, 871, -294, 617, 249, -294, 234, 248, -294, -294, + 241, 921, 7, 15, 15, 10, 239, 82, 15, -294, + -294, 224, 225, 226, 82, 270, 270, -294, 97, -294, + 250, 871, 212, 256, 113, 285, 258, -294, -294, 243, + 617, 15, 1021, 721, 617, -294, -294, -294, 13, 228, + 229, -294, -294, -294, -294, 267, -294, 271, 305, 971, + 283, -294, 241, 921, -294, 211, -294, 15, 97, 97, + -294, -294, 721, -294, -294, 257, -294, 871, 240, 242, + -294, -294, 281, 15, 15, 251, 871, 871, -294, 287, + 288, 255, 261, -294, -294 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -689,63 +721,71 @@ static const yytype_int16 yypact[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 3, 0, 0, 5, 0, 1, 152, 166, 167, 4, - 2, 0, 0, 165, 0, 0, 0, 0, 0, 0, - 0, 34, 0, 0, 155, 156, 140, 0, 164, 13, - 0, 6, 0, 15, 81, 22, 0, 123, 7, 27, - 0, 153, 41, 168, 169, 81, 21, 43, 45, 37, - 50, 0, 125, 126, 0, 131, 129, 130, 0, 127, - 134, 132, 135, 133, 0, 81, 0, 85, 87, 89, - 91, 93, 95, 97, 105, 107, 110, 112, 114, 117, - 120, 119, 128, 32, 30, 31, 28, 29, 0, 55, - 56, 0, 152, 0, 0, 0, 0, 81, 154, 0, - 14, 0, 12, 17, 82, 0, 0, 124, 18, 77, - 76, 78, 0, 0, 0, 0, 19, 74, 0, 47, - 0, 0, 0, 96, 121, 122, 124, 0, 152, 0, + 4, 9, 0, 0, 6, 145, 132, 133, 0, 138, + 136, 137, 0, 173, 134, 174, 175, 176, 177, 178, + 140, 141, 139, 0, 0, 0, 0, 87, 0, 91, + 93, 95, 97, 99, 101, 103, 111, 113, 116, 118, + 120, 123, 126, 125, 135, 130, 47, 0, 1, 161, + 102, 127, 0, 128, 129, 3, 88, 0, 131, 80, + 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 152, 0, - 0, 9, 10, 0, 0, 0, 152, 124, 0, 0, - 139, 16, 80, 0, 0, 0, 0, 42, 81, 81, - 44, 138, 136, 137, 0, 48, 51, 0, 52, 53, - 86, 8, 62, 88, 90, 92, 94, 99, 104, 103, - 102, 98, 100, 101, 106, 109, 108, 111, 113, 115, - 116, 118, 0, 152, 26, 11, 0, 0, 71, 0, - 0, 0, 0, 0, 153, 0, 35, 36, 75, 20, - 79, 0, 157, 0, 0, 46, 0, 54, 64, 152, - 0, 60, 23, 0, 0, 0, 0, 0, 0, 0, - 0, 152, 152, 0, 0, 33, 0, 0, 0, 159, - 81, 152, 152, 49, 0, 69, 65, 66, 62, 63, - 24, 25, 152, 57, 0, 0, 83, 0, 152, 0, - 146, 143, 0, 0, 0, 152, 81, 81, 158, 0, - 161, 0, 0, 0, 0, 0, 67, 61, 0, 0, - 0, 152, 8, 0, 40, 145, 141, 81, 0, 0, - 144, 162, 163, 160, 0, 0, 0, 152, 0, 39, - 58, 152, 72, 71, 84, 0, 0, 0, 150, 151, - 8, 70, 59, 0, 73, 152, 0, 0, 68, 38, - 0, 0, 0, 0, 152, 152, 147, 0, 0, 0, - 0, 148, 149 + 0, 0, 229, 230, 5, 2, 40, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 164, 165, + 0, 19, 7, 0, 21, 87, 28, 0, 8, 33, + 0, 162, 144, 0, 0, 84, 92, 94, 96, 98, + 100, 109, 108, 105, 110, 104, 106, 107, 112, 115, + 114, 117, 119, 121, 122, 124, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, + 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 179, 48, 231, 232, 87, + 27, 49, 51, 43, 56, 0, 0, 38, 36, 34, + 35, 37, 0, 61, 62, 0, 161, 0, 0, 0, + 0, 87, 163, 0, 20, 18, 23, 0, 131, 24, + 83, 82, 0, 0, 86, 81, 0, 25, 0, 53, + 0, 0, 0, 161, 161, 0, 0, 15, 16, 0, + 0, 0, 161, 131, 0, 0, 22, 0, 0, 87, + 87, 85, 50, 143, 142, 0, 54, 57, 0, 58, + 59, 14, 68, 0, 161, 32, 17, 0, 0, 77, + 0, 0, 154, 148, 0, 162, 0, 41, 42, 26, + 0, 166, 0, 0, 52, 0, 60, 70, 161, 0, + 66, 29, 0, 0, 0, 0, 0, 0, 152, 0, + 161, 161, 0, 150, 39, 0, 0, 0, 168, 87, + 161, 161, 55, 0, 75, 71, 72, 68, 69, 30, + 31, 161, 63, 0, 0, 89, 0, 161, 0, 155, + 149, 0, 0, 0, 161, 87, 87, 167, 0, 170, + 0, 161, 12, 0, 0, 0, 0, 73, 67, 0, + 0, 0, 161, 14, 0, 46, 153, 146, 87, 0, + 0, 151, 171, 172, 169, 0, 13, 0, 0, 161, + 0, 45, 64, 161, 78, 77, 90, 0, 0, 0, + 159, 160, 14, 76, 65, 0, 79, 161, 0, 0, + 74, 44, 0, 0, 0, 0, 161, 161, 156, 0, + 0, 0, 0, 157, 158 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -205, -205, -205, -205, -124, -148, 298, -26, -205, -6, - 188, 99, 83, 190, -205, -205, 106, -205, -205, 54, - -205, 58, -205, -205, 7, -25, -205, -21, -33, 20, - 135, 191, 193, 194, 192, -45, -205, 56, 185, 66, - 195, 182, 67, -56, -4, 211, 158, -205, -205, -205, - -204, -205, -138, -128, -87, -163, 53, -102, 48, 27 + -294, -294, -294, -294, -294, -293, -233, -231, -38, -85, + -294, -46, 101, 54, 40, 99, -294, -294, 69, -294, + -294, 23, -294, 22, -294, -294, -40, -99, -294, -103, + -96, -11, 3, 276, 282, 284, 290, 27, -294, 130, + 272, 102, 279, 269, 128, 39, 21, 120, 90, -294, + -294, -294, -268, -294, -229, -227, -199, -245, 25, -157, + -12, -294, 98 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 2, 3, 6, 150, 151, 152, 32, 33, 65, - 46, 47, 174, 49, 50, 178, 91, 290, 35, 231, - 255, 256, 257, 285, 238, 107, 108, 163, 117, 265, - 111, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 175, 37, 38, - 210, 211, 39, 40, 41, 223, 248, 249, 42, 9 + -1, 3, 4, 49, 26, 340, 236, 237, 238, 103, + 104, 27, 190, 191, 255, 193, 194, 259, 205, 351, + 106, 290, 314, 315, 316, 346, 297, 58, 219, 114, + 59, 324, 115, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 256, + 45, 108, 271, 272, 109, 110, 111, 282, 307, 308, + 46, 186, 84 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -753,285 +793,347 @@ static const yytype_int16 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { - 34, 110, 36, 100, 205, 45, 224, 36, 125, 123, - 104, 119, 104, 109, 127, 127, 7, 97, 212, 36, - 116, 13, 7, 34, 202, 36, 7, 127, 213, 209, - 127, 127, 127, 127, 43, 44, 1, 270, 271, -142, - 126, 4, 127, 246, 247, 92, 89, 5, 128, 98, - 90, 306, 133, 134, 135, 136, 13, 228, 13, 13, - 48, 102, 51, 28, 295, 24, 25, 94, 236, 214, - 96, 300, 157, 103, 93, 166, 166, 161, 160, 233, - 115, 120, 221, 8, 162, 127, 34, 186, 36, 8, - 160, 201, 293, 8, 26, 272, 273, 34, 28, 36, - 28, 28, 182, 212, 212, 95, 124, 141, 118, 137, - 30, 142, 289, 213, 213, 148, 138, 139, 113, 114, - 243, 121, 34, 156, 36, 274, 99, 281, 282, 89, - 212, 113, 114, 90, 315, 222, 222, 212, 288, 129, - 213, 153, 34, 312, 36, 220, 34, 213, 36, -74, - 66, -74, 88, 122, 214, 214, 83, 84, 85, 112, - 167, 168, 169, 145, 146, 101, 48, 130, 313, 51, - 86, 131, 229, 87, 230, 34, 203, 36, 132, 171, - 172, 214, 208, 321, 173, 158, 159, 323, 214, 187, - 188, 189, 190, 191, 192, 193, 328, 34, 140, 36, - 143, 330, 144, 258, 60, 61, 62, 195, 196, 63, - 337, 338, 199, 200, 326, 327, 147, 280, 154, 165, - 204, 206, -124, 34, 215, 36, 149, 216, 218, 217, - 155, 225, 226, 232, 237, 240, 244, 127, 241, 242, - 254, 164, 259, 301, 302, 34, 34, 36, 36, 260, - 251, 252, 267, 269, 278, 279, 34, 48, 36, 104, - 284, 230, 262, 294, 222, 304, 268, 297, 298, 250, - 305, 275, 299, 307, 308, 309, 316, 318, 320, 317, - 319, 333, 322, 336, 329, 34, 34, 36, 36, 207, - 341, 291, 292, 331, 276, 277, 296, 332, 339, 340, - 219, 34, 342, 36, 31, 34, 170, 36, 239, 253, - 234, 176, 287, 314, 34, 286, 36, 311, 180, 34, - 324, 36, 183, 185, 184, 194, 198, 250, 34, 34, - 36, 36, 303, 179, 0, 227, 0, 0, 197, 0, - 0, 235, 325, 0, 0, 0, 0, 0, 0, 10, - 245, 0, 0, 0, 0, 0, 0, 0, 334, 335, - 0, 0, 0, 0, 250, 250, 11, 12, 0, 261, - 13, 263, 266, 14, 15, 0, 0, 0, 0, 16, - 17, 0, 18, 0, 0, 19, 0, 0, 0, 283, - 20, 181, 0, 0, 0, 0, 21, 0, 0, 0, - 22, 23, 0, 24, 25, 0, 26, 11, 12, 27, - 0, 13, 28, 0, 14, 15, 0, 29, 0, 0, - 16, 17, 30, 18, 310, 0, 19, 0, 266, 0, - 0, 20, 0, 104, 52, 53, 54, 21, 0, 0, - 0, 0, 23, 0, 24, 25, 0, 26, 0, 0, - 27, 13, 0, 28, 0, 0, 0, 0, 29, 0, - 0, 0, 0, 30, 52, 53, 54, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 55, 56, - 57, 13, 0, 58, 0, 0, 0, 26, 0, 0, - 0, 0, 0, 28, 59, 60, 61, 62, 0, 0, - 63, 0, 105, 106, 0, 64, 0, 0, 55, 56, - 57, 0, 0, 58, 52, 53, 54, 26, 0, 0, - 0, 0, 0, 28, 59, 60, 61, 62, 0, 0, - 63, 13, 105, 30, 0, 64, 264, 0, 0, 0, - 0, 0, 0, 0, 52, 53, 54, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 55, 56, - 57, 13, 0, 58, 0, 0, 0, 26, 0, 0, - 0, 0, 0, 28, 59, 60, 61, 62, 52, 53, - 63, 0, 0, 30, 0, 64, 0, 0, 55, 56, - 57, 0, 0, 58, 0, 13, 0, 26, 0, 0, - 0, 0, 0, 28, 59, 60, 61, 62, 52, 53, - 63, 0, 0, 30, 0, 64, 0, 0, 0, 0, - 0, 0, 55, 56, 57, 0, 0, 58, 0, 0, - 0, 26, 0, 0, 0, 0, 0, 28, 59, 60, - 61, 62, 0, 0, 63, 0, 0, 30, 0, 64, - 0, 0, 55, 56, 57, 0, 0, 0, 0, 11, - 12, -152, -152, 13, 0, 0, 14, 15, 59, 60, - 61, 62, 16, 17, 63, 18, 0, 0, 19, 177, - 0, 0, 0, 20, 0, 0, 0, 0, 0, 21, - 0, 0, 0, 0, 23, 0, 24, 25, 0, 26, - 11, 12, 27, 0, 13, 28, 0, 14, 15, 0, - 29, 0, 0, 16, 17, 30, 18, -8, 0, 19, - 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, - 21, 0, 0, 0, 0, 23, 0, 24, 25, 0, - 26, 0, 0, 27, 0, 0, 28, 0, 0, 0, - 0, 29, 0, 11, 12, 0, 30, 13, 0, 0, - 14, 15, 0, 0, 0, 0, 16, 17, -8, 18, - 0, 0, 19, 0, 0, 0, 0, 20, 0, 0, - 0, 0, 0, 21, 0, 0, 0, 0, 23, 0, - 24, 25, 0, 26, 11, 12, 27, 0, 13, 28, - 0, 14, 15, 0, 29, -8, 0, 16, 17, 30, - 18, 0, 0, 19, 0, 0, 0, 0, 20, 0, - 0, 0, 0, 0, 21, 0, 0, 0, 0, 23, - 0, 24, 25, 0, 26, 11, 12, 27, 0, 13, - 28, 0, 14, 15, 0, 29, 0, 0, 16, 17, - 30, 18, 0, 0, 19, 0, 0, 0, 0, 20, - 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, - 23, 0, 24, 25, 0, 26, 0, -8, 27, 0, - 0, 28, 0, 0, 0, 0, 29, 0, 11, 12, - 0, 30, 13, 0, 0, 14, 15, 0, 0, 0, - 0, 16, 17, 0, 18, 0, 0, 19, 0, 0, - 0, 0, 20, 0, 0, 0, 0, 0, 21, 0, - 0, 0, 0, 23, 0, 24, 25, 0, 26, 0, - 0, 27, 0, 0, 28, 0, 0, 0, 0, 29, - 0, 0, 0, 0, 30 + 51, 263, 220, 105, 28, 283, 218, 266, 56, 221, + 224, 102, 61, 273, 82, 274, 214, 229, 343, 56, + 82, 60, 331, 332, 61, 82, 52, 61, 287, 61, + 61, 292, 329, 330, 55, 50, 61, 1, 61, 61, + -80, 189, -80, 275, 66, 67, 68, 47, 366, 333, + 48, 211, 233, 20, 21, 105, 203, 22, 69, 356, + 204, 74, 62, 53, 54, 75, 361, 226, 64, 185, + 107, 273, 273, 274, 274, 350, 192, 195, 57, 226, + 83, 112, 208, 2, 210, 354, 83, 230, 349, 280, + 227, 83, 120, 196, 392, 202, 112, 288, 273, 289, + 274, 275, 275, 399, 400, 273, 270, 274, 107, 70, + 222, 223, 243, 377, 63, -147, 71, 72, 107, 135, + 375, 374, 107, 251, 61, 78, 79, 65, 275, 6, + 7, 246, 76, 61, 73, 275, 383, 253, 98, 99, + 385, 254, 197, 198, 305, 306, 295, 368, 262, 390, + 207, 80, 302, 281, 281, 199, 222, 223, 200, 13, + 105, 15, 16, 17, 18, 19, 9, 10, 11, 13, + 105, 15, 16, 17, 18, 19, 129, 130, 203, 14, + 187, 188, 204, 77, 201, 20, 21, 105, 105, 22, + 212, 206, 105, 81, 258, 239, 121, 122, 123, 124, + 125, 126, 127, 317, 244, 245, 133, 134, 235, 209, + 249, 250, 241, 339, 213, 105, 192, 215, 105, 195, + 247, 388, 389, 216, 225, 342, 342, 107, 13, 228, + 15, 16, 17, 18, 19, 231, 232, 107, 265, 362, + 363, 240, 105, 268, 248, -131, 267, 276, 277, 278, + 284, 279, 285, 291, 107, 107, 342, 296, 192, 107, + 299, 61, 281, 303, 105, 105, 313, 318, 309, 319, + 294, 326, 341, 341, 328, 105, 56, 337, 338, 304, + 345, 289, 107, 365, 355, 107, 358, 359, 360, 367, + 369, 370, 380, 335, 336, 105, 320, 381, 322, 325, + 234, 371, 342, 341, 378, 379, 105, 105, 242, 107, + 382, 342, 342, 384, 395, 391, 344, 393, 398, 394, + 401, 402, 403, 105, 298, 312, 309, 105, 404, 252, + 257, 107, 107, 264, 293, 386, 105, 116, 347, 269, + 348, 105, 107, 376, 117, 128, 132, 118, 286, 341, + 105, 105, 260, 372, 119, 131, 0, 325, 341, 341, + 0, 0, 107, 364, 0, 0, 309, 309, 0, 0, + 300, 301, 0, 107, 107, 0, 0, 0, 0, 5, + 310, 311, 0, 0, 0, 0, 0, 0, 0, 0, + 107, 0, 321, 0, 107, 0, 327, 56, 0, 0, + 0, 334, 5, 107, 6, 7, 8, 0, 107, 0, + 0, 0, 0, 0, 0, 0, 0, 107, 107, 0, + 0, 352, 353, 0, 0, 0, 357, 0, 0, 0, + 13, 0, 15, 16, 17, 18, 19, 0, 0, 0, + 0, 9, 10, 11, 23, 0, 12, 0, 0, 373, + 0, 0, 0, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 0, 0, 22, 0, 113, 217, 0, 24, + 85, 0, 0, 25, 0, 387, 86, 5, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 87, + 88, 396, 397, 0, 0, 89, 90, 0, 0, 0, + 0, 91, 92, 0, 93, 0, 0, 94, 0, 0, + 0, 95, 0, 0, 0, 0, 0, 0, 0, 96, + 97, 261, 98, 99, 0, 100, 86, 5, 13, 0, + 15, 16, 17, 18, 19, 0, 0, 101, 0, 87, + 88, 0, 23, 0, 0, 89, 90, 0, 0, 0, + 0, 91, 92, 0, 93, 0, 5, 94, 6, 7, + 8, 95, 0, 0, 0, 0, 0, 0, 0, 0, + 97, 0, 98, 99, 0, 100, 0, 0, 13, 0, + 15, 16, 17, 18, 19, 0, 0, 101, 0, 0, + 0, 0, 23, 0, 0, 9, 10, 11, 0, 5, + 12, 6, 7, 8, 0, 0, 0, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 0, 0, 22, 323, + 113, 23, 0, 24, 0, 0, 0, 25, 5, 0, + 6, 7, 8, 0, 0, 0, 0, 0, 9, 10, + 11, 0, 0, 12, 0, 0, 0, 0, 0, 0, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 0, + 0, 22, 0, 0, 23, 0, 24, 9, 10, 11, + 25, 5, 12, 6, 7, 0, 0, 0, 0, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 0, 0, + 22, 0, 0, 23, 0, 24, 0, 0, 0, 25, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 9, 10, 11, 0, 0, 12, 0, 0, 0, 0, + 0, 0, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 86, 5, 22, 0, 0, 23, 0, 24, 0, + 0, 0, 25, 0, 87, 88, -161, -161, 0, 0, + 89, 90, 0, 0, 0, 0, 91, 92, 0, 93, + 0, 0, 94, 0, 0, 0, 95, 0, 0, 0, + 0, 0, 0, 0, 0, 97, 0, 98, 99, 0, + 100, 86, 5, 13, 0, 15, 16, 17, 18, 19, + 0, 0, 101, 0, 87, 88, 0, 23, 0, 0, + 89, 90, 0, 0, 0, 0, 91, 92, 0, 93, + -14, 0, 94, 0, 0, 0, 95, 0, 0, 0, + 0, 0, 0, 0, 0, 97, 0, 98, 99, 0, + 100, 86, 5, 13, 0, 15, 16, 17, 18, 19, + 0, 0, 101, 0, 87, 88, 0, 23, 0, 0, + 89, 90, 0, 0, 0, 0, 91, 92, -14, 93, + 0, 0, 94, 0, 0, 0, 95, 0, 0, 0, + 0, 0, 0, 0, 0, 97, 0, 98, 99, 0, + 100, 86, 5, 13, 0, 15, 16, 17, 18, 19, + 0, 0, 101, 0, 87, 88, 0, 23, 0, 0, + 89, 90, 0, 0, -11, 0, 91, 92, 0, 93, + 0, 0, 94, 0, 0, 0, 95, 0, 0, 0, + 0, 0, 0, 0, 0, 97, 0, 98, 99, 0, + 100, 86, 5, 13, 0, 15, 16, 17, 18, 19, + 0, 0, 101, 0, 87, 88, 0, 23, 0, 0, + 89, 90, 0, 0, 0, 0, 91, 92, 0, 93, + 0, 0, 94, 0, 0, 0, 95, 0, 0, 0, + 0, 0, 0, 0, 0, 97, 0, 98, 99, -14, + 100, 86, 5, 13, 0, 15, 16, 17, 18, 19, + 0, 0, 101, 0, 87, 88, 0, 23, 0, 0, + 89, 90, 0, 0, -14, 0, 91, 92, 0, 93, + 0, 0, 94, 0, 0, 0, 95, 0, 0, 0, + 0, 0, 0, 0, 0, 97, 0, 98, 99, 0, + 100, 86, 5, 13, 0, 15, 16, 17, 18, 19, + 0, 0, 101, 0, 87, 88, 0, 23, 0, 0, + 89, 90, 0, 0, 0, 0, 91, 92, 0, 93, + 0, 0, 94, 0, 0, 0, 95, 0, 0, 0, + 0, 0, 0, 0, 0, 97, 0, 98, 99, 0, + 100, 0, 0, 13, 0, 15, 16, 17, 18, 19, + 0, 0, 101, 0, 0, 0, 0, 23, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, + 178, 179, 180, 181, 182, 183, 184, 13, 0, 15, + 16, 17, 18, 19 }; static const yytype_int16 yycheck[] = { - 6, 34, 6, 29, 152, 11, 169, 11, 64, 54, - 6, 6, 6, 34, 14, 14, 4, 23, 156, 23, - 45, 24, 4, 29, 148, 29, 4, 14, 156, 21, - 14, 14, 14, 14, 7, 8, 48, 241, 242, 31, - 65, 49, 14, 46, 47, 18, 34, 0, 32, 59, - 38, 32, 15, 16, 17, 18, 24, 181, 24, 24, - 12, 4, 14, 66, 268, 57, 58, 19, 40, 156, - 22, 275, 97, 71, 42, 75, 75, 103, 77, 203, - 76, 76, 76, 71, 105, 14, 92, 132, 92, 71, - 77, 147, 75, 71, 60, 25, 26, 103, 66, 103, - 66, 66, 128, 241, 242, 45, 58, 78, 75, 72, - 76, 82, 41, 241, 242, 88, 79, 80, 22, 23, - 24, 75, 128, 96, 128, 55, 61, 251, 252, 34, - 268, 22, 23, 38, 297, 168, 169, 275, 262, 13, - 268, 93, 148, 291, 148, 166, 152, 275, 152, 72, - 15, 74, 17, 72, 241, 242, 22, 23, 24, 74, - 112, 113, 114, 84, 85, 30, 118, 12, 292, 121, - 36, 11, 29, 39, 31, 181, 149, 181, 10, 68, - 69, 268, 155, 307, 73, 64, 65, 311, 275, 133, - 134, 135, 136, 137, 138, 139, 320, 203, 81, 203, - 19, 325, 83, 229, 68, 69, 70, 141, 142, 73, - 334, 335, 145, 146, 316, 317, 86, 250, 72, 72, - 37, 43, 74, 229, 72, 229, 91, 62, 77, 73, - 95, 77, 75, 35, 45, 31, 66, 14, 211, 212, - 30, 106, 28, 276, 277, 251, 252, 251, 252, 37, - 223, 224, 31, 54, 77, 75, 262, 209, 262, 6, - 29, 31, 235, 44, 297, 31, 239, 66, 66, 221, - 31, 244, 66, 4, 31, 62, 76, 22, 4, 76, - 23, 31, 28, 24, 62, 291, 292, 291, 292, 154, - 24, 264, 265, 77, 246, 247, 269, 77, 31, 31, - 165, 307, 24, 307, 6, 311, 118, 311, 209, 226, - 204, 121, 258, 293, 320, 257, 320, 290, 127, 325, - 313, 325, 129, 131, 130, 140, 144, 279, 334, 335, - 334, 335, 279, 122, -1, 177, -1, -1, 143, -1, - -1, 206, 315, -1, -1, -1, -1, -1, -1, 3, - 215, -1, -1, -1, -1, -1, -1, -1, 331, 332, - -1, -1, -1, -1, 316, 317, 20, 21, -1, 234, - 24, 236, 237, 27, 28, -1, -1, -1, -1, 33, - 34, -1, 36, -1, -1, 39, -1, -1, -1, 254, - 44, 4, -1, -1, -1, -1, 50, -1, -1, -1, - 54, 55, -1, 57, 58, -1, 60, 20, 21, 63, - -1, 24, 66, -1, 27, 28, -1, 71, -1, -1, - 33, 34, 76, 36, 289, -1, 39, -1, 293, -1, - -1, 44, -1, 6, 7, 8, 9, 50, -1, -1, - -1, -1, 55, -1, 57, 58, -1, 60, -1, -1, - 63, 24, -1, 66, -1, -1, -1, -1, 71, -1, - -1, -1, -1, 76, 7, 8, 9, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 51, 52, - 53, 24, -1, 56, -1, -1, -1, 60, -1, -1, - -1, -1, -1, 66, 67, 68, 69, 70, -1, -1, - 73, -1, 75, 76, -1, 78, -1, -1, 51, 52, - 53, -1, -1, 56, 7, 8, 9, 60, -1, -1, - -1, -1, -1, 66, 67, 68, 69, 70, -1, -1, - 73, 24, 75, 76, -1, 78, 29, -1, -1, -1, - -1, -1, -1, -1, 7, 8, 9, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 51, 52, - 53, 24, -1, 56, -1, -1, -1, 60, -1, -1, - -1, -1, -1, 66, 67, 68, 69, 70, 7, 8, - 73, -1, -1, 76, -1, 78, -1, -1, 51, 52, - 53, -1, -1, 56, -1, 24, -1, 60, -1, -1, - -1, -1, -1, 66, 67, 68, 69, 70, 7, 8, - 73, -1, -1, 76, -1, 78, -1, -1, -1, -1, - -1, -1, 51, 52, 53, -1, -1, 56, -1, -1, - -1, 60, -1, -1, -1, -1, -1, 66, 67, 68, - 69, 70, -1, -1, 73, -1, -1, 76, -1, 78, - -1, -1, 51, 52, 53, -1, -1, -1, -1, 20, - 21, 22, 23, 24, -1, -1, 27, 28, 67, 68, - 69, 70, 33, 34, 73, 36, -1, -1, 39, 78, - -1, -1, -1, 44, -1, -1, -1, -1, -1, 50, - -1, -1, -1, -1, 55, -1, 57, 58, -1, 60, - 20, 21, 63, -1, 24, 66, -1, 27, 28, -1, - 71, -1, -1, 33, 34, 76, 36, 37, -1, 39, - -1, -1, -1, -1, 44, -1, -1, -1, -1, -1, - 50, -1, -1, -1, -1, 55, -1, 57, 58, -1, - 60, -1, -1, 63, -1, -1, 66, -1, -1, -1, - -1, 71, -1, 20, 21, -1, 76, 24, -1, -1, - 27, 28, -1, -1, -1, -1, 33, 34, 35, 36, - -1, -1, 39, -1, -1, -1, -1, 44, -1, -1, - -1, -1, -1, 50, -1, -1, -1, -1, 55, -1, - 57, 58, -1, 60, 20, 21, 63, -1, 24, 66, - -1, 27, 28, -1, 71, 31, -1, 33, 34, 76, - 36, -1, -1, 39, -1, -1, -1, -1, 44, -1, - -1, -1, -1, -1, 50, -1, -1, -1, -1, 55, - -1, 57, 58, -1, 60, 20, 21, 63, -1, 24, - 66, -1, 27, 28, -1, 71, -1, -1, 33, 34, - 76, 36, -1, -1, 39, -1, -1, -1, -1, 44, - -1, -1, -1, -1, -1, 50, -1, -1, -1, -1, - 55, -1, 57, 58, -1, 60, -1, 62, 63, -1, - -1, 66, -1, -1, -1, -1, 71, -1, 20, 21, - -1, 76, 24, -1, -1, 27, 28, -1, -1, -1, - -1, 33, 34, -1, 36, -1, -1, 39, -1, -1, - -1, -1, 44, -1, -1, -1, -1, -1, 50, -1, - -1, -1, -1, 55, -1, 57, 58, -1, 60, -1, - -1, 63, -1, -1, 66, -1, -1, -1, -1, 71, - -1, -1, -1, -1, 76 + 12, 234, 105, 49, 1, 250, 105, 238, 6, 105, + 113, 49, 20, 242, 5, 242, 101, 6, 311, 6, + 5, 5, 27, 28, 20, 5, 23, 20, 261, 20, + 20, 264, 300, 301, 4, 8, 20, 3, 20, 20, + 72, 87, 74, 242, 7, 8, 9, 66, 341, 54, + 0, 97, 34, 69, 70, 101, 36, 73, 21, 327, + 40, 78, 19, 24, 25, 82, 334, 75, 17, 81, + 49, 300, 301, 300, 301, 68, 88, 89, 76, 75, + 71, 77, 94, 49, 96, 75, 71, 76, 321, 76, + 189, 71, 65, 90, 387, 92, 77, 31, 327, 33, + 327, 300, 301, 396, 397, 334, 24, 334, 87, 72, + 25, 26, 211, 358, 18, 33, 79, 80, 97, 80, + 353, 352, 101, 226, 20, 84, 85, 16, 327, 13, + 14, 216, 22, 20, 81, 334, 369, 69, 56, 57, + 373, 73, 25, 26, 47, 48, 42, 34, 233, 382, + 43, 86, 67, 249, 250, 38, 25, 26, 41, 62, + 206, 64, 65, 66, 67, 68, 50, 51, 52, 62, + 216, 64, 65, 66, 67, 68, 74, 75, 36, 63, + 82, 83, 40, 83, 67, 69, 70, 233, 234, 73, + 64, 93, 238, 74, 78, 207, 66, 67, 68, 69, + 70, 71, 72, 288, 60, 61, 78, 79, 205, 46, + 222, 223, 209, 309, 65, 261, 228, 5, 264, 231, + 217, 378, 379, 71, 77, 310, 311, 206, 62, 75, + 64, 65, 66, 67, 68, 75, 72, 216, 39, 335, + 336, 72, 288, 240, 72, 74, 44, 72, 58, 73, + 77, 248, 75, 37, 233, 234, 341, 46, 270, 238, + 33, 20, 358, 62, 310, 311, 32, 30, 280, 39, + 267, 33, 310, 311, 53, 321, 6, 77, 75, 276, + 31, 33, 261, 33, 45, 264, 62, 62, 62, 33, + 5, 33, 25, 305, 306, 341, 293, 26, 295, 296, + 202, 58, 387, 341, 76, 76, 352, 353, 210, 288, + 5, 396, 397, 30, 33, 58, 313, 77, 67, 77, + 33, 33, 67, 369, 270, 285, 338, 373, 67, 228, + 231, 310, 311, 235, 265, 375, 382, 61, 316, 241, + 317, 387, 321, 354, 62, 73, 77, 63, 258, 387, + 396, 397, 232, 350, 64, 76, -1, 354, 396, 397, + -1, -1, 341, 338, -1, -1, 378, 379, -1, -1, + 272, 273, -1, 352, 353, -1, -1, -1, -1, 11, + 282, 283, -1, -1, -1, -1, -1, -1, -1, -1, + 369, -1, 294, -1, 373, -1, 298, 6, -1, -1, + -1, 303, 11, 382, 13, 14, 15, -1, 387, -1, + -1, -1, -1, -1, -1, -1, -1, 396, 397, -1, + -1, 323, 324, -1, -1, -1, 328, -1, -1, -1, + 62, -1, 64, 65, 66, 67, 68, -1, -1, -1, + -1, 50, 51, 52, 76, -1, 55, -1, -1, 351, + -1, -1, -1, 62, 63, 64, 65, 66, 67, 68, + 69, 70, -1, -1, 73, -1, 75, 76, -1, 78, + 4, -1, -1, 82, -1, 377, 10, 11, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, + 24, 393, 394, -1, -1, 29, 30, -1, -1, -1, + -1, 35, 36, -1, 38, -1, -1, 41, -1, -1, + -1, 45, -1, -1, -1, -1, -1, -1, -1, 53, + 54, 5, 56, 57, -1, 59, 10, 11, 62, -1, + 64, 65, 66, 67, 68, -1, -1, 71, -1, 23, + 24, -1, 76, -1, -1, 29, 30, -1, -1, -1, + -1, 35, 36, -1, 38, -1, 11, 41, 13, 14, + 15, 45, -1, -1, -1, -1, -1, -1, -1, -1, + 54, -1, 56, 57, -1, 59, -1, -1, 62, -1, + 64, 65, 66, 67, 68, -1, -1, 71, -1, -1, + -1, -1, 76, -1, -1, 50, 51, 52, -1, 11, + 55, 13, 14, 15, -1, -1, -1, 62, 63, 64, + 65, 66, 67, 68, 69, 70, -1, -1, 73, 31, + 75, 76, -1, 78, -1, -1, -1, 82, 11, -1, + 13, 14, 15, -1, -1, -1, -1, -1, 50, 51, + 52, -1, -1, 55, -1, -1, -1, -1, -1, -1, + 62, 63, 64, 65, 66, 67, 68, 69, 70, -1, + -1, 73, -1, -1, 76, -1, 78, 50, 51, 52, + 82, 11, 55, 13, 14, -1, -1, -1, -1, 62, + 63, 64, 65, 66, 67, 68, 69, 70, -1, -1, + 73, -1, -1, 76, -1, 78, -1, -1, -1, 82, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 50, 51, 52, -1, -1, 55, -1, -1, -1, -1, + -1, -1, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 10, 11, 73, -1, -1, 76, -1, 78, -1, + -1, -1, 82, -1, 23, 24, 25, 26, -1, -1, + 29, 30, -1, -1, -1, -1, 35, 36, -1, 38, + -1, -1, 41, -1, -1, -1, 45, -1, -1, -1, + -1, -1, -1, -1, -1, 54, -1, 56, 57, -1, + 59, 10, 11, 62, -1, 64, 65, 66, 67, 68, + -1, -1, 71, -1, 23, 24, -1, 76, -1, -1, + 29, 30, -1, -1, -1, -1, 35, 36, -1, 38, + 39, -1, 41, -1, -1, -1, 45, -1, -1, -1, + -1, -1, -1, -1, -1, 54, -1, 56, 57, -1, + 59, 10, 11, 62, -1, 64, 65, 66, 67, 68, + -1, -1, 71, -1, 23, 24, -1, 76, -1, -1, + 29, 30, -1, -1, -1, -1, 35, 36, 37, 38, + -1, -1, 41, -1, -1, -1, 45, -1, -1, -1, + -1, -1, -1, -1, -1, 54, -1, 56, 57, -1, + 59, 10, 11, 62, -1, 64, 65, 66, 67, 68, + -1, -1, 71, -1, 23, 24, -1, 76, -1, -1, + 29, 30, -1, -1, 33, -1, 35, 36, -1, 38, + -1, -1, 41, -1, -1, -1, 45, -1, -1, -1, + -1, -1, -1, -1, -1, 54, -1, 56, 57, -1, + 59, 10, 11, 62, -1, 64, 65, 66, 67, 68, + -1, -1, 71, -1, 23, 24, -1, 76, -1, -1, + 29, 30, -1, -1, -1, -1, 35, 36, -1, 38, + -1, -1, 41, -1, -1, -1, 45, -1, -1, -1, + -1, -1, -1, -1, -1, 54, -1, 56, 57, 58, + 59, 10, 11, 62, -1, 64, 65, 66, 67, 68, + -1, -1, 71, -1, 23, 24, -1, 76, -1, -1, + 29, 30, -1, -1, 33, -1, 35, 36, -1, 38, + -1, -1, 41, -1, -1, -1, 45, -1, -1, -1, + -1, -1, -1, -1, -1, 54, -1, 56, 57, -1, + 59, 10, 11, 62, -1, 64, 65, 66, 67, 68, + -1, -1, 71, -1, 23, 24, -1, 76, -1, -1, + 29, 30, -1, -1, -1, -1, 35, 36, -1, 38, + -1, -1, 41, -1, -1, -1, 45, -1, -1, -1, + -1, -1, -1, -1, -1, 54, -1, 56, 57, -1, + 59, -1, -1, 62, -1, 64, 65, 66, 67, 68, + -1, -1, 71, -1, -1, -1, -1, 76, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, -1, 64, + 65, 66, 67, 68 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 48, 88, 89, 49, 0, 90, 4, 71, 146, - 3, 20, 21, 24, 27, 28, 33, 34, 36, 39, - 44, 50, 54, 55, 57, 58, 60, 63, 66, 71, - 76, 93, 94, 95, 96, 105, 131, 135, 136, 139, - 140, 141, 145, 146, 146, 96, 97, 98, 145, 100, - 101, 145, 7, 8, 9, 51, 52, 53, 56, 67, - 68, 69, 70, 73, 78, 96, 117, 118, 119, 120, + 0, 3, 49, 88, 89, 11, 13, 14, 15, 50, + 51, 52, 55, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 73, 76, 78, 82, 91, 98, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, - 131, 132, 133, 22, 23, 24, 36, 39, 117, 34, - 38, 103, 146, 42, 145, 45, 145, 96, 59, 61, - 94, 117, 4, 71, 6, 75, 76, 112, 113, 114, - 115, 117, 74, 22, 23, 76, 112, 115, 75, 6, - 76, 75, 72, 122, 145, 130, 112, 14, 32, 13, - 12, 11, 10, 15, 16, 17, 18, 72, 79, 80, - 81, 78, 82, 19, 83, 84, 85, 86, 146, 117, - 91, 92, 93, 145, 72, 117, 146, 112, 64, 65, - 77, 94, 114, 114, 117, 72, 75, 145, 145, 145, - 97, 68, 69, 73, 99, 134, 100, 78, 102, 132, - 118, 4, 94, 119, 120, 121, 122, 124, 124, 124, - 124, 124, 124, 124, 125, 126, 126, 127, 128, 129, - 129, 130, 91, 146, 37, 92, 43, 117, 146, 21, - 137, 138, 139, 140, 141, 72, 62, 73, 77, 117, - 114, 76, 115, 142, 142, 77, 75, 133, 91, 29, - 31, 106, 35, 91, 103, 117, 40, 45, 111, 98, - 31, 146, 146, 24, 66, 117, 46, 47, 143, 144, - 145, 146, 146, 99, 30, 107, 108, 109, 94, 28, - 37, 117, 146, 117, 29, 116, 117, 31, 146, 54, - 137, 137, 25, 26, 55, 146, 145, 145, 77, 75, - 115, 91, 91, 117, 29, 110, 108, 106, 91, 41, - 104, 146, 146, 75, 44, 137, 146, 66, 66, 66, - 137, 115, 115, 143, 31, 31, 32, 4, 31, 62, - 117, 146, 92, 91, 116, 142, 76, 76, 22, 23, - 4, 91, 28, 91, 111, 146, 144, 144, 91, 62, - 91, 77, 77, 31, 146, 146, 24, 91, 91, 31, - 31, 24, 24 + 131, 132, 133, 134, 135, 137, 147, 66, 0, 90, + 124, 147, 119, 132, 132, 4, 6, 76, 114, 117, + 5, 20, 19, 18, 17, 16, 7, 8, 9, 21, + 72, 79, 80, 81, 78, 82, 22, 83, 84, 85, + 86, 74, 5, 71, 149, 4, 10, 23, 24, 29, + 30, 35, 36, 38, 41, 45, 53, 54, 56, 57, + 59, 71, 95, 96, 97, 98, 107, 133, 138, 141, + 142, 143, 77, 75, 116, 119, 120, 121, 122, 123, + 124, 126, 126, 126, 126, 126, 126, 126, 127, 128, + 128, 129, 130, 131, 131, 132, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 147, 148, 149, 149, 98, + 99, 100, 147, 102, 103, 147, 119, 25, 26, 38, + 41, 67, 119, 36, 40, 105, 149, 43, 147, 46, + 147, 98, 64, 65, 96, 5, 71, 76, 114, 115, + 116, 117, 25, 26, 116, 77, 75, 114, 75, 6, + 76, 75, 72, 34, 149, 119, 93, 94, 95, 147, + 72, 119, 149, 114, 60, 61, 96, 119, 72, 147, + 147, 116, 99, 69, 73, 101, 136, 102, 78, 104, + 134, 5, 96, 93, 149, 39, 94, 44, 119, 149, + 24, 139, 140, 141, 142, 143, 72, 58, 73, 119, + 76, 117, 144, 144, 77, 75, 135, 93, 31, 33, + 108, 37, 93, 105, 119, 42, 46, 113, 100, 33, + 149, 149, 67, 62, 119, 47, 48, 145, 146, 147, + 149, 149, 101, 32, 109, 110, 111, 96, 30, 39, + 119, 149, 119, 31, 118, 119, 33, 149, 53, 139, + 139, 27, 28, 54, 149, 147, 147, 77, 75, 117, + 92, 95, 96, 92, 119, 31, 112, 110, 108, 93, + 68, 106, 149, 149, 75, 45, 139, 149, 62, 62, + 62, 139, 117, 117, 145, 33, 92, 33, 34, 5, + 33, 58, 119, 149, 94, 93, 118, 144, 76, 76, + 25, 26, 5, 93, 30, 93, 113, 149, 146, 146, + 93, 58, 92, 77, 77, 33, 149, 149, 67, 92, + 92, 33, 33, 67, 67 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 87, 88, 89, 89, 90, 90, 90, 91, 91, - 92, 92, 93, 94, 94, 94, 94, 94, 95, 95, - 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, - 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, - 95, 96, 96, 97, 97, 98, 98, 98, 99, 99, - 100, 100, 101, 102, 102, 103, 103, 104, 104, 105, - 105, 105, 106, 106, 107, 107, 108, 108, 109, 110, - 110, 111, 111, 111, 112, 112, 113, 113, 114, 114, - 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, - 119, 120, 120, 121, 121, 122, 122, 123, 123, 123, - 123, 123, 123, 123, 123, 124, 124, 125, 125, 125, - 126, 126, 127, 127, 128, 128, 128, 129, 129, 130, + 0, 87, 88, 88, 89, 89, 90, 90, 90, 91, + 91, 92, 92, 92, 93, 93, 94, 94, 95, 96, + 96, 96, 96, 96, 97, 97, 97, 97, 97, 97, + 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, + 97, 97, 97, 97, 97, 97, 97, 98, 98, 99, + 99, 100, 100, 100, 101, 101, 102, 102, 103, 104, + 104, 105, 105, 106, 106, 107, 107, 107, 108, 108, + 109, 109, 110, 110, 111, 112, 112, 113, 113, 113, + 114, 114, 115, 115, 116, 116, 116, 117, 117, 118, + 118, 119, 119, 120, 120, 121, 121, 122, 122, 123, + 123, 124, 124, 125, 125, 125, 125, 125, 125, 125, + 125, 126, 126, 127, 127, 127, 128, 128, 129, 129, 130, 130, 130, 131, 131, 132, 132, 132, 132, 132, - 132, 132, 133, 133, 133, 133, 134, 134, 134, 135, - 135, 136, 137, 137, 137, 137, 137, 138, 138, 138, - 139, 139, 140, 140, 141, 141, 141, 142, 142, 143, - 143, 144, 144, 144, 145, 145, 146, 146, 146, 146 + 133, 133, 134, 134, 134, 134, 134, 134, 134, 135, + 135, 135, 136, 136, 137, 137, 138, 139, 139, 139, + 139, 139, 139, 139, 139, 139, 140, 140, 140, 141, + 141, 142, 142, 143, 143, 143, 144, 144, 145, 145, + 146, 146, 146, 147, 147, 147, 147, 147, 147, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 149, + 149, 149, 149 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { - 0, 2, 3, 0, 3, 0, 2, 2, 0, 1, - 1, 2, 2, 1, 2, 1, 3, 2, 2, 3, - 4, 2, 1, 5, 6, 6, 4, 1, 2, 2, - 2, 2, 2, 5, 1, 4, 4, 2, 10, 8, - 7, 1, 3, 1, 3, 1, 4, 2, 1, 3, - 1, 3, 3, 1, 2, 1, 1, 0, 2, 9, - 5, 7, 0, 2, 0, 1, 1, 2, 5, 0, - 3, 0, 4, 5, 1, 3, 1, 1, 1, 3, - 2, 0, 1, 1, 3, 1, 3, 1, 3, 1, - 3, 1, 3, 1, 3, 1, 2, 1, 3, 3, - 3, 3, 3, 3, 3, 1, 3, 1, 3, 3, - 1, 3, 1, 3, 1, 3, 3, 1, 3, 1, - 1, 2, 2, 1, 2, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, - 1, 7, 0, 3, 4, 4, 3, 9, 11, 11, - 8, 8, 0, 1, 2, 1, 1, 1, 3, 1, - 3, 2, 3, 3, 1, 1, 1, 1, 2, 2 + 0, 2, 3, 3, 0, 3, 0, 2, 2, 0, + 2, 0, 1, 2, 0, 1, 1, 2, 2, 1, + 2, 1, 3, 2, 2, 3, 4, 2, 1, 5, + 6, 6, 4, 1, 2, 2, 2, 2, 2, 5, + 1, 4, 4, 2, 10, 8, 7, 1, 3, 1, + 3, 1, 4, 2, 1, 3, 1, 3, 3, 1, + 2, 1, 1, 0, 2, 9, 5, 7, 0, 2, + 0, 1, 1, 2, 5, 0, 3, 0, 4, 5, + 1, 3, 1, 1, 1, 3, 2, 0, 1, 1, + 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, + 3, 1, 2, 1, 3, 3, 3, 3, 3, 3, + 3, 1, 3, 1, 3, 3, 1, 3, 1, 3, + 1, 3, 3, 1, 3, 1, 1, 2, 2, 2, + 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 3, 1, 7, 0, 1, 3, + 2, 4, 2, 4, 1, 3, 9, 11, 11, 8, + 8, 0, 1, 2, 1, 1, 1, 3, 1, 3, + 2, 3, 3, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 2 }; @@ -1047,22 +1149,22 @@ static const yytype_uint8 yyr2[] = #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (ctx, YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (0) +#define YYBACKUP(Token, Value) \ + do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (ctx, YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ + while (0) /* Error token number */ #define YYTERROR 1 @@ -1102,38 +1204,38 @@ do { \ } while (0) -/*----------------------------------------. -| Print this symbol's value on YYOUTPUT. | -`----------------------------------------*/ +/*-----------------------------------. +| Print this symbol's value on YYO. | +`-----------------------------------*/ static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, parser_ctx_t *ctx) +yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, parser_ctx_t *ctx) { - FILE *yyo = yyoutput; - YYUSE (yyo); + FILE *yyoutput = yyo; + YYUSE (yyoutput); YYUSE (ctx); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); + YYPRINT (yyo, yytoknum[yytype], *yyvaluep); # endif YYUSE (yytype); } -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +/*---------------------------. +| Print this symbol on YYO. | +`---------------------------*/ static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, parser_ctx_t *ctx) +yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, parser_ctx_t *ctx) { - YYFPRINTF (yyoutput, "%s %s (", + YYFPRINTF (yyo, "%s %s (", yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); - yy_symbol_value_print (yyoutput, yytype, yyvaluep, ctx); - YYFPRINTF (yyoutput, ")"); + yy_symbol_value_print (yyo, yytype, yyvaluep, ctx); + YYFPRINTF (yyo, ")"); } /*------------------------------------------------------------------. @@ -1167,7 +1269,7 @@ do { \ static void yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, parser_ctx_t *ctx) { - unsigned long int yylno = yyrline[yyrule]; + unsigned long yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", @@ -1178,7 +1280,7 @@ yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, parser_ctx_t * YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yystos[yyssp[yyi + 1 - yynrhs]], - &(yyvsp[(yyi + 1) - (yynrhs)]) + &yyvsp[(yyi + 1) - (yynrhs)] , ctx); YYFPRINTF (stderr, "\n"); } @@ -1282,7 +1384,10 @@ yytnamerr (char *yyres, const char *yystr) case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; - /* Fall through. */ + else + goto append; + + append: default: if (yyres) yyres[yyn] = *yyp; @@ -1300,7 +1405,7 @@ yytnamerr (char *yyres, const char *yystr) if (! yyres) return yystrlen (yystr); - return yystpcpy (yyres, yystr) - yyres; + return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres); } # endif @@ -1316,11 +1421,11 @@ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ - const char *yyformat = YY_NULL; + const char *yyformat = YY_NULLPTR; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per @@ -1377,11 +1482,11 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } yyarg[yycount++] = yytname[yyx]; { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else return 2; - yysize = yysize1; } } } @@ -1393,6 +1498,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, case N: \ yyformat = S; \ break + default: /* Avoid compiler warnings. */ YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); @@ -1404,9 +1510,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, { YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else return 2; - yysize = yysize1; } if (*yymsg_alloc < yysize) @@ -1537,23 +1644,33 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; + /*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | +| yynewstate -- push a new state, which is found in yystate. | `------------------------------------------------------------*/ - yynewstate: +yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; - yysetstate: - *yyssp = yystate; + +/*--------------------------------------------------------------------. +| yynewstate -- set current state (the top of the stack) to yystate. | +`--------------------------------------------------------------------*/ +yysetstate: + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + YY_ASSERT (0 <= yystate && yystate < YYNSTATES); + *yyssp = (yytype_int16) yystate; if (yyss + yystacksize - 1 <= yyssp) +#if !defined yyoverflow && !defined YYSTACK_RELOCATE + goto yyexhaustedlab; +#else { /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; + YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1); -#ifdef yyoverflow +# if defined yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into @@ -1569,14 +1686,10 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); - yyss = yyss1; yyvs = yyvs1; } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else +# else /* defined YYSTACK_RELOCATE */ /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; @@ -1592,35 +1705,33 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); -# undef YYSTACK_RELOCATE +# undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif -#endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + (unsigned long) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); +#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ if (yystate == YYFINAL) YYACCEPT; goto yybackup; + /*-----------. | yybackup. | `-----------*/ yybackup: - /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ @@ -1678,7 +1789,6 @@ yybackup: YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END - goto yynewstate; @@ -1693,7 +1803,7 @@ yydefault: /*-----------------------------. -| yyreduce -- Do a reduction. | +| yyreduce -- do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ @@ -1713,965 +1823,1345 @@ yyreduce: YY_REDUCE_PRINT (yyn); switch (yyn) { - case 2: -#line 147 "parser.y" /* yacc.c:1646 */ + case 2: +#line 148 "parser.y" { parse_complete(ctx, (yyvsp[-2].boolean)); } -#line 1720 "parser.tab.c" /* yacc.c:1646 */ +#line 1830 "parser.tab.c" break; case 3: -#line 150 "parser.y" /* yacc.c:1646 */ - { (yyval.boolean) = FALSE; } -#line 1726 "parser.tab.c" /* yacc.c:1646 */ +#line 149 "parser.y" + { handle_isexpression_script(ctx, (yyvsp[-1].expression)); } +#line 1836 "parser.tab.c" break; case 4: -#line 151 "parser.y" /* yacc.c:1646 */ - { (yyval.boolean) = TRUE; } -#line 1732 "parser.tab.c" /* yacc.c:1646 */ +#line 152 "parser.y" + { (yyval.boolean) = FALSE; } +#line 1842 "parser.tab.c" break; - case 6: -#line 155 "parser.y" /* yacc.c:1646 */ - { source_add_statement(ctx, (yyvsp[0].statement)); } -#line 1738 "parser.tab.c" /* yacc.c:1646 */ + case 5: +#line 153 "parser.y" + { (yyval.boolean) = TRUE; } +#line 1848 "parser.tab.c" break; case 7: -#line 156 "parser.y" /* yacc.c:1646 */ - { source_add_class(ctx, (yyvsp[0].class_decl)); } -#line 1744 "parser.tab.c" /* yacc.c:1646 */ +#line 157 "parser.y" + { source_add_statement(ctx, (yyvsp[0].statement)); } +#line 1854 "parser.tab.c" break; case 8: -#line 159 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = NULL; } -#line 1750 "parser.tab.c" /* yacc.c:1646 */ +#line 158 "parser.y" + { source_add_class(ctx, (yyvsp[0].class_decl)); } +#line 1860 "parser.tab.c" break; case 9: -#line 160 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = (yyvsp[0].statement); } -#line 1756 "parser.tab.c" /* yacc.c:1646 */ +#line 161 "parser.y" + { (yyval.expression) = NULL; } +#line 1866 "parser.tab.c" break; case 10: -#line 163 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = (yyvsp[0].statement); } -#line 1762 "parser.tab.c" /* yacc.c:1646 */ +#line 162 "parser.y" + { (yyval.expression) = (yyvsp[-1].expression); } +#line 1872 "parser.tab.c" break; case 11: -#line 164 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = link_statements((yyvsp[-1].statement), (yyvsp[0].statement)); } -#line 1768 "parser.tab.c" /* yacc.c:1646 */ +#line 165 "parser.y" + { (yyval.statement) = NULL; } +#line 1878 "parser.tab.c" break; case 12: -#line 167 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = (yyvsp[-1].statement); } -#line 1774 "parser.tab.c" /* yacc.c:1646 */ +#line 166 "parser.y" + { (yyval.statement) = (yyvsp[0].statement); } +#line 1884 "parser.tab.c" break; case 13: -#line 170 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = NULL; } -#line 1780 "parser.tab.c" /* yacc.c:1646 */ +#line 167 "parser.y" + { (yyval.statement) = link_statements((yyvsp[-1].statement), (yyvsp[0].statement)); } +#line 1890 "parser.tab.c" break; case 14: -#line 171 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = (yyvsp[0].statement); } -#line 1786 "parser.tab.c" /* yacc.c:1646 */ +#line 170 "parser.y" + { (yyval.statement) = NULL; } +#line 1896 "parser.tab.c" break; case 15: -#line 172 "parser.y" /* yacc.c:1646 */ +#line 171 "parser.y" { (yyval.statement) = (yyvsp[0].statement); } -#line 1792 "parser.tab.c" /* yacc.c:1646 */ +#line 1902 "parser.tab.c" break; case 16: -#line 173 "parser.y" /* yacc.c:1646 */ - { (yyvsp[-2].statement)->next = (yyvsp[0].statement); (yyval.statement) = (yyvsp[-2].statement); } -#line 1798 "parser.tab.c" /* yacc.c:1646 */ +#line 174 "parser.y" + { (yyval.statement) = (yyvsp[0].statement); } +#line 1908 "parser.tab.c" break; case 17: -#line 174 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = (yyvsp[-1].statement); } -#line 1804 "parser.tab.c" /* yacc.c:1646 */ +#line 175 "parser.y" + { (yyval.statement) = link_statements((yyvsp[-1].statement), (yyvsp[0].statement)); } +#line 1914 "parser.tab.c" break; case 18: -#line 177 "parser.y" /* yacc.c:1646 */ - { (yyvsp[-1].member)->args = (yyvsp[0].expression); (yyval.statement) = new_call_statement(ctx, FALSE, (yyvsp[-1].member)); CHECK_ERROR; } -#line 1810 "parser.tab.c" /* yacc.c:1646 */ +#line 178 "parser.y" + { (yyval.statement) = (yyvsp[-1].statement); } +#line 1920 "parser.tab.c" break; case 19: -#line 178 "parser.y" /* yacc.c:1646 */ - { (yyvsp[-1].member)->args = (yyvsp[0].expression); (yyval.statement) = new_call_statement(ctx, TRUE, (yyvsp[-1].member)); CHECK_ERROR; } -#line 1816 "parser.tab.c" /* yacc.c:1646 */ +#line 181 "parser.y" + { (yyval.statement) = NULL; } +#line 1926 "parser.tab.c" break; case 20: -#line 180 "parser.y" /* yacc.c:1646 */ - { (yyvsp[-3].member)->args = (yyvsp[-2].expression); (yyval.statement) = new_assign_statement(ctx, (yyvsp[-3].member), (yyvsp[0].expression)); CHECK_ERROR; } -#line 1822 "parser.tab.c" /* yacc.c:1646 */ +#line 182 "parser.y" + { (yyval.statement) = (yyvsp[0].statement); } +#line 1932 "parser.tab.c" break; case 21: -#line 181 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_dim_statement(ctx, (yyvsp[0].dim_decl)); CHECK_ERROR; } -#line 1828 "parser.tab.c" /* yacc.c:1646 */ +#line 183 "parser.y" + { (yyval.statement) = (yyvsp[0].statement); } +#line 1938 "parser.tab.c" break; case 22: -#line 182 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = (yyvsp[0].statement); } -#line 1834 "parser.tab.c" /* yacc.c:1646 */ +#line 184 "parser.y" + { (yyvsp[-2].statement)->next = (yyvsp[0].statement); (yyval.statement) = (yyvsp[-2].statement); } +#line 1944 "parser.tab.c" break; case 23: -#line 184 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_while_statement(ctx, STAT_WHILE, (yyvsp[-3].expression), (yyvsp[-1].statement)); CHECK_ERROR; } -#line 1840 "parser.tab.c" /* yacc.c:1646 */ +#line 185 "parser.y" + { (yyval.statement) = (yyvsp[-1].statement); } +#line 1950 "parser.tab.c" break; case 24: -#line 186 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_while_statement(ctx, (yyvsp[-4].boolean) ? STAT_WHILELOOP : STAT_UNTIL, (yyvsp[-3].expression), (yyvsp[-1].statement)); - CHECK_ERROR; } -#line 1847 "parser.tab.c" /* yacc.c:1646 */ +#line 188 "parser.y" + { (yyvsp[-1].member)->args = (yyvsp[0].expression); (yyval.statement) = new_call_statement(ctx, FALSE, (yyvsp[-1].member)); CHECK_ERROR; } +#line 1956 "parser.tab.c" break; case 25: -#line 189 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_while_statement(ctx, (yyvsp[-1].boolean) ? STAT_DOWHILE : STAT_DOUNTIL, (yyvsp[0].expression), (yyvsp[-3].statement)); - CHECK_ERROR; } -#line 1854 "parser.tab.c" /* yacc.c:1646 */ +#line 189 "parser.y" + { (yyvsp[-1].member)->args = (yyvsp[0].expression); (yyval.statement) = new_call_statement(ctx, TRUE, (yyvsp[-1].member)); CHECK_ERROR; } +#line 1962 "parser.tab.c" break; case 26: -#line 191 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_while_statement(ctx, STAT_DOWHILE, NULL, (yyvsp[-1].statement)); CHECK_ERROR; } -#line 1860 "parser.tab.c" /* yacc.c:1646 */ +#line 191 "parser.y" + { (yyvsp[-3].member)->args = (yyvsp[-2].expression); (yyval.statement) = new_assign_statement(ctx, (yyvsp[-3].member), (yyvsp[0].expression)); CHECK_ERROR; } +#line 1968 "parser.tab.c" break; case 27: -#line 192 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_function_statement(ctx, (yyvsp[0].func_decl)); CHECK_ERROR; } -#line 1866 "parser.tab.c" /* yacc.c:1646 */ +#line 192 "parser.y" + { (yyval.statement) = new_dim_statement(ctx, (yyvsp[0].dim_decl)); CHECK_ERROR; } +#line 1974 "parser.tab.c" break; case 28: -#line 193 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_statement(ctx, STAT_EXITDO, 0); CHECK_ERROR; } -#line 1872 "parser.tab.c" /* yacc.c:1646 */ +#line 193 "parser.y" + { (yyval.statement) = (yyvsp[0].statement); } +#line 1980 "parser.tab.c" break; case 29: -#line 194 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_statement(ctx, STAT_EXITFOR, 0); CHECK_ERROR; } -#line 1878 "parser.tab.c" /* yacc.c:1646 */ +#line 195 "parser.y" + { (yyval.statement) = new_while_statement(ctx, STAT_WHILE, (yyvsp[-3].expression), (yyvsp[-1].statement)); CHECK_ERROR; } +#line 1986 "parser.tab.c" break; case 30: -#line 195 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_statement(ctx, STAT_EXITFUNC, 0); CHECK_ERROR; } -#line 1884 "parser.tab.c" /* yacc.c:1646 */ +#line 197 "parser.y" + { (yyval.statement) = new_while_statement(ctx, (yyvsp[-4].boolean) ? STAT_WHILELOOP : STAT_UNTIL, (yyvsp[-3].expression), (yyvsp[-1].statement)); + CHECK_ERROR; } +#line 1993 "parser.tab.c" break; case 31: -#line 196 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_statement(ctx, STAT_EXITPROP, 0); CHECK_ERROR; } -#line 1890 "parser.tab.c" /* yacc.c:1646 */ +#line 200 "parser.y" + { (yyval.statement) = new_while_statement(ctx, (yyvsp[-1].boolean) ? STAT_DOWHILE : STAT_DOUNTIL, (yyvsp[0].expression), (yyvsp[-3].statement)); + CHECK_ERROR; } +#line 2000 "parser.tab.c" break; case 32: -#line 197 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_statement(ctx, STAT_EXITSUB, 0); CHECK_ERROR; } -#line 1896 "parser.tab.c" /* yacc.c:1646 */ +#line 202 "parser.y" + { (yyval.statement) = new_while_statement(ctx, STAT_DOWHILE, NULL, (yyvsp[-1].statement)); CHECK_ERROR; } +#line 2006 "parser.tab.c" break; case 33: -#line 199 "parser.y" /* yacc.c:1646 */ - { (yyvsp[-3].member)->args = (yyvsp[-2].expression); (yyval.statement) = new_set_statement(ctx, (yyvsp[-3].member), (yyvsp[0].expression)); CHECK_ERROR; } -#line 1902 "parser.tab.c" /* yacc.c:1646 */ +#line 203 "parser.y" + { (yyval.statement) = new_function_statement(ctx, (yyvsp[0].func_decl)); CHECK_ERROR; } +#line 2012 "parser.tab.c" break; case 34: -#line 200 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_statement(ctx, STAT_STOP, 0); CHECK_ERROR; } -#line 1908 "parser.tab.c" /* yacc.c:1646 */ +#line 204 "parser.y" + { (yyval.statement) = new_statement(ctx, STAT_EXITDO, 0); CHECK_ERROR; } +#line 2018 "parser.tab.c" break; case 35: -#line 201 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_onerror_statement(ctx, TRUE); CHECK_ERROR; } -#line 1914 "parser.tab.c" /* yacc.c:1646 */ +#line 205 "parser.y" + { (yyval.statement) = new_statement(ctx, STAT_EXITFOR, 0); CHECK_ERROR; } +#line 2024 "parser.tab.c" break; case 36: -#line 202 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_onerror_statement(ctx, FALSE); CHECK_ERROR; } -#line 1920 "parser.tab.c" /* yacc.c:1646 */ +#line 206 "parser.y" + { (yyval.statement) = new_statement(ctx, STAT_EXITFUNC, 0); CHECK_ERROR; } +#line 2030 "parser.tab.c" break; case 37: -#line 203 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_const_statement(ctx, (yyvsp[0].const_decl)); CHECK_ERROR; } -#line 1926 "parser.tab.c" /* yacc.c:1646 */ +#line 207 "parser.y" + { (yyval.statement) = new_statement(ctx, STAT_EXITPROP, 0); CHECK_ERROR; } +#line 2036 "parser.tab.c" break; case 38: -#line 205 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_forto_statement(ctx, (yyvsp[-8].string), (yyvsp[-6].expression), (yyvsp[-4].expression), (yyvsp[-3].expression), (yyvsp[-1].statement)); CHECK_ERROR; } -#line 1932 "parser.tab.c" /* yacc.c:1646 */ +#line 208 "parser.y" + { (yyval.statement) = new_statement(ctx, STAT_EXITSUB, 0); CHECK_ERROR; } +#line 2042 "parser.tab.c" break; case 39: -#line 207 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_foreach_statement(ctx, (yyvsp[-5].string), (yyvsp[-3].expression), (yyvsp[-1].statement)); } -#line 1938 "parser.tab.c" /* yacc.c:1646 */ +#line 210 "parser.y" + { (yyvsp[-3].member)->args = (yyvsp[-2].expression); (yyval.statement) = new_set_statement(ctx, (yyvsp[-3].member), (yyvsp[0].expression)); CHECK_ERROR; } +#line 2048 "parser.tab.c" break; case 40: -#line 209 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_select_statement(ctx, (yyvsp[-4].expression), (yyvsp[-2].case_clausule)); } -#line 1944 "parser.tab.c" /* yacc.c:1646 */ +#line 211 "parser.y" + { (yyval.statement) = new_statement(ctx, STAT_STOP, 0); CHECK_ERROR; } +#line 2054 "parser.tab.c" break; case 41: -#line 212 "parser.y" /* yacc.c:1646 */ - { (yyval.member) = new_member_expression(ctx, NULL, (yyvsp[0].string)); CHECK_ERROR; } -#line 1950 "parser.tab.c" /* yacc.c:1646 */ +#line 212 "parser.y" + { (yyval.statement) = new_onerror_statement(ctx, TRUE); CHECK_ERROR; } +#line 2060 "parser.tab.c" break; case 42: -#line 213 "parser.y" /* yacc.c:1646 */ - { (yyval.member) = new_member_expression(ctx, (yyvsp[-2].expression), (yyvsp[0].string)); CHECK_ERROR; } -#line 1956 "parser.tab.c" /* yacc.c:1646 */ +#line 213 "parser.y" + { (yyval.statement) = new_onerror_statement(ctx, FALSE); CHECK_ERROR; } +#line 2066 "parser.tab.c" break; case 43: -#line 216 "parser.y" /* yacc.c:1646 */ - { (yyval.dim_decl) = (yyvsp[0].dim_decl); } -#line 1962 "parser.tab.c" /* yacc.c:1646 */ +#line 214 "parser.y" + { (yyval.statement) = new_const_statement(ctx, (yyvsp[0].const_decl)); CHECK_ERROR; } +#line 2072 "parser.tab.c" break; case 44: -#line 217 "parser.y" /* yacc.c:1646 */ - { (yyvsp[-2].dim_decl)->next = (yyvsp[0].dim_decl); (yyval.dim_decl) = (yyvsp[-2].dim_decl); } -#line 1968 "parser.tab.c" /* yacc.c:1646 */ +#line 216 "parser.y" + { (yyval.statement) = new_forto_statement(ctx, (yyvsp[-8].string), (yyvsp[-6].expression), (yyvsp[-4].expression), (yyvsp[-3].expression), (yyvsp[-1].statement)); CHECK_ERROR; } +#line 2078 "parser.tab.c" break; case 45: -#line 220 "parser.y" /* yacc.c:1646 */ - { (yyval.dim_decl) = new_dim_decl(ctx, (yyvsp[0].string), FALSE, NULL); CHECK_ERROR; } -#line 1974 "parser.tab.c" /* yacc.c:1646 */ +#line 218 "parser.y" + { (yyval.statement) = new_foreach_statement(ctx, (yyvsp[-5].string), (yyvsp[-3].expression), (yyvsp[-1].statement)); } +#line 2084 "parser.tab.c" break; case 46: -#line 221 "parser.y" /* yacc.c:1646 */ - { (yyval.dim_decl) = new_dim_decl(ctx, (yyvsp[-3].string), TRUE, (yyvsp[-1].dim_list)); CHECK_ERROR; } -#line 1980 "parser.tab.c" /* yacc.c:1646 */ +#line 220 "parser.y" + { (yyval.statement) = new_select_statement(ctx, (yyvsp[-4].expression), (yyvsp[-2].case_clausule)); } +#line 2090 "parser.tab.c" break; case 47: -#line 222 "parser.y" /* yacc.c:1646 */ - { (yyval.dim_decl) = new_dim_decl(ctx, (yyvsp[-1].string), TRUE, NULL); CHECK_ERROR; } -#line 1986 "parser.tab.c" /* yacc.c:1646 */ +#line 223 "parser.y" + { (yyval.member) = new_member_expression(ctx, NULL, (yyvsp[0].string)); CHECK_ERROR; } +#line 2096 "parser.tab.c" break; case 48: -#line 225 "parser.y" /* yacc.c:1646 */ - { (yyval.dim_list) = new_dim(ctx, (yyvsp[0].uint), NULL); } -#line 1992 "parser.tab.c" /* yacc.c:1646 */ +#line 224 "parser.y" + { (yyval.member) = new_member_expression(ctx, (yyvsp[-2].expression), (yyvsp[0].string)); CHECK_ERROR; } +#line 2102 "parser.tab.c" break; case 49: -#line 226 "parser.y" /* yacc.c:1646 */ - { (yyval.dim_list) = new_dim(ctx, (yyvsp[-2].uint), (yyvsp[0].dim_list)); } -#line 1998 "parser.tab.c" /* yacc.c:1646 */ +#line 227 "parser.y" + { (yyval.dim_decl) = (yyvsp[0].dim_decl); } +#line 2108 "parser.tab.c" break; case 50: -#line 229 "parser.y" /* yacc.c:1646 */ - { (yyval.const_decl) = (yyvsp[0].const_decl); } -#line 2004 "parser.tab.c" /* yacc.c:1646 */ +#line 228 "parser.y" + { (yyvsp[-2].dim_decl)->next = (yyvsp[0].dim_decl); (yyval.dim_decl) = (yyvsp[-2].dim_decl); } +#line 2114 "parser.tab.c" break; case 51: -#line 230 "parser.y" /* yacc.c:1646 */ - { (yyvsp[-2].const_decl)->next = (yyvsp[0].const_decl); (yyval.const_decl) = (yyvsp[-2].const_decl); } -#line 2010 "parser.tab.c" /* yacc.c:1646 */ +#line 231 "parser.y" + { (yyval.dim_decl) = new_dim_decl(ctx, (yyvsp[0].string), FALSE, NULL); CHECK_ERROR; } +#line 2120 "parser.tab.c" break; case 52: -#line 233 "parser.y" /* yacc.c:1646 */ - { (yyval.const_decl) = new_const_decl(ctx, (yyvsp[-2].string), (yyvsp[0].expression)); CHECK_ERROR; } -#line 2016 "parser.tab.c" /* yacc.c:1646 */ +#line 232 "parser.y" + { (yyval.dim_decl) = new_dim_decl(ctx, (yyvsp[-3].string), TRUE, (yyvsp[-1].dim_list)); CHECK_ERROR; } +#line 2126 "parser.tab.c" break; case 53: -#line 236 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = (yyvsp[0].expression); } -#line 2022 "parser.tab.c" /* yacc.c:1646 */ +#line 233 "parser.y" + { (yyval.dim_decl) = new_dim_decl(ctx, (yyvsp[-1].string), TRUE, NULL); CHECK_ERROR; } +#line 2132 "parser.tab.c" break; case 54: -#line 237 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = new_unary_expression(ctx, EXPR_NEG, (yyvsp[0].expression)); CHECK_ERROR; } -#line 2028 "parser.tab.c" /* yacc.c:1646 */ +#line 236 "parser.y" + { (yyval.dim_list) = new_dim(ctx, (yyvsp[0].uint), NULL); } +#line 2138 "parser.tab.c" break; case 55: -#line 240 "parser.y" /* yacc.c:1646 */ - { (yyval.boolean) = TRUE; } -#line 2034 "parser.tab.c" /* yacc.c:1646 */ +#line 237 "parser.y" + { (yyval.dim_list) = new_dim(ctx, (yyvsp[-2].uint), (yyvsp[0].dim_list)); } +#line 2144 "parser.tab.c" break; case 56: -#line 241 "parser.y" /* yacc.c:1646 */ - { (yyval.boolean) = FALSE; } -#line 2040 "parser.tab.c" /* yacc.c:1646 */ +#line 240 "parser.y" + { (yyval.const_decl) = (yyvsp[0].const_decl); } +#line 2150 "parser.tab.c" break; case 57: -#line 244 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = NULL;} -#line 2046 "parser.tab.c" /* yacc.c:1646 */ +#line 241 "parser.y" + { (yyvsp[-2].const_decl)->next = (yyvsp[0].const_decl); (yyval.const_decl) = (yyvsp[-2].const_decl); } +#line 2156 "parser.tab.c" break; case 58: -#line 245 "parser.y" /* yacc.c:1646 */ - { (yyval.expression) = (yyvsp[0].expression); } -#line 2052 "parser.tab.c" /* yacc.c:1646 */ +#line 244 "parser.y" + { (yyval.const_decl) = new_const_decl(ctx, (yyvsp[-2].string), (yyvsp[0].expression)); CHECK_ERROR; } +#line 2162 "parser.tab.c" break; case 59: -#line 249 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_if_statement(ctx, (yyvsp[-7].expression), (yyvsp[-4].statement), (yyvsp[-3].elseif), (yyvsp[-2].statement)); CHECK_ERROR; } -#line 2058 "parser.tab.c" /* yacc.c:1646 */ +#line 247 "parser.y" + { (yyval.expression) = (yyvsp[0].expression); } +#line 2168 "parser.tab.c" break; case 60: -#line 250 "parser.y" /* yacc.c:1646 */ - { (yyval.statement) = new_if_statement(ctx, (yyvsp[-3].expression), (yyvsp[-1].statement), NULL, NULL); CHECK_ERROR; } -#line 2064 "parser.tab.c" /* yacc.c:1646 */ +#line 248 "parser.y" + { (yyval.expression) = new_unary_expression(ctx, EXPR_NEG, (yyvsp[0].expression)); CHECK_ERROR; } +#line 2174 "parser.tab.c" ... 3379 lines suppressed ...
1
0
0
0
← Newer
1
...
963
964
965
966
967
968
969
...
8139
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
Results per page:
10
25
50
100
200