[WMIC] Sync with Wine Staging 1.9.11. CORE-11368

svn path=/trunk/; revision=71519
This commit is contained in:
Amine Khaldi 2016-06-04 18:04:03 +00:00
parent 9cd4c53ae9
commit fe2ef00a13
11 changed files with 72 additions and 13 deletions

View file

@ -5,4 +5,5 @@ STRINGTABLE
STRING_CMDLINE_NOT_SUPPORTED, "Fehler: Befehlszeile nicht unterstützt\n"
STRING_ALIAS_NOT_FOUND, "Fehler: Alias nicht gefunden\n"
STRING_INVALID_QUERY, "Fehler: Ungültige Abfrage\n"
STRING_INVALID_PATH, "Invalid syntax for PATH\n"
}

View file

@ -5,4 +5,5 @@ STRINGTABLE
STRING_CMDLINE_NOT_SUPPORTED, "Error: Command line not supported\n"
STRING_ALIAS_NOT_FOUND, "Error: Alias not found\n"
STRING_INVALID_QUERY, "Error: Invalid query\n"
STRING_INVALID_PATH, "Invalid syntax for PATH\n"
}

View file

@ -7,4 +7,5 @@ STRINGTABLE
STRING_CMDLINE_NOT_SUPPORTED, "Eroare: Comandă nerecunoscută.\n"
STRING_ALIAS_NOT_FOUND, "Eroare: Nu se poate găsi alias.\n"
STRING_INVALID_QUERY, "Eroare: Cerere nevalidă.\n"
STRING_INVALID_PATH, "Invalid syntax for PATH\n"
}

View file

@ -5,4 +5,5 @@ STRINGTABLE
STRING_CMDLINE_NOT_SUPPORTED, "Ошибка: Командная строка не поддерживается\n"
STRING_ALIAS_NOT_FOUND, "Ошибка: Псевдоним не найден\n"
STRING_INVALID_QUERY, "Ошибка: Неверный запрос\n"
STRING_INVALID_PATH, "Invalid syntax for PATH\n"
}

View file

@ -9,4 +9,5 @@ STRINGTABLE
STRING_CMDLINE_NOT_SUPPORTED, "Gabim: Linja e komandave jo e mbështetur\n"
STRING_ALIAS_NOT_FOUND, "Gabim: Pseudonimi nuk u gjend\n"
STRING_INVALID_QUERY, "Gabim: Kërkim pa vlere\n"
STRING_INVALID_PATH, "Invalid syntax for PATH\n"
}

View file

@ -7,4 +7,5 @@ STRINGTABLE
STRING_CMDLINE_NOT_SUPPORTED, "Yanlışlık: Komut yatacı desteklenmiyor\n"
STRING_ALIAS_NOT_FOUND, "Yanlışlık: Başka ad bulunamadı\n"
STRING_INVALID_QUERY, "Yanlışlık: Geçersiz sorgu\n"
STRING_INVALID_PATH, "Invalid syntax for PATH\n"
}

View file

@ -7,4 +7,5 @@ STRINGTABLE
STRING_CMDLINE_NOT_SUPPORTED, "错误: 不支持的命令行\n"
STRING_ALIAS_NOT_FOUND, "错误: 别名未找到\n"
STRING_INVALID_QUERY, "错误: 无效的查询\n"
STRING_INVALID_PATH, "Invalid syntax for PATH\n"
}

View file

@ -7,4 +7,5 @@ STRINGTABLE
STRING_CMDLINE_NOT_SUPPORTED, "錯誤: 不支援的命令列\n"
STRING_ALIAS_NOT_FOUND, "錯誤: 別名未找到\n"
STRING_INVALID_QUERY, "錯誤: 無效的查詢\n"
STRING_INVALID_PATH, "Invalid syntax for PATH\n"
}

View file

@ -162,7 +162,7 @@ static int output_message( int msg )
return output_string( fmtW, buffer );
}
static int query_prop( const WCHAR *alias, const WCHAR *propname )
static int query_prop( const WCHAR *class, const WCHAR *propname )
{
static const WCHAR select_allW[] = {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',0};
static const WCHAR cimv2W[] = {'R','O','O','T','\\','C','I','M','V','2',0};
@ -175,18 +175,12 @@ static int query_prop( const WCHAR *alias, const WCHAR *propname )
IEnumWbemClassObject *result = NULL;
LONG flags = WBEM_FLAG_RETURN_IMMEDIATELY | WBEM_FLAG_FORWARD_ONLY;
BSTR path = NULL, wql = NULL, query = NULL;
const WCHAR *class;
WCHAR *prop = NULL;
BOOL first = TRUE;
int len, ret = -1;
WINE_TRACE("%s, %s\n", debugstr_w(alias), debugstr_w(propname));
WINE_TRACE("%s, %s\n", debugstr_w(class), debugstr_w(propname));
if (!(class = find_class( alias )))
{
output_message( STRING_ALIAS_NOT_FOUND );
return -1;
}
CoInitialize( NULL );
CoInitializeSecurity( NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_DEFAULT,
RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL );
@ -253,11 +247,67 @@ done:
int wmain(int argc, WCHAR *argv[])
{
static const WCHAR getW[] = {'g','e','t',0};
static const WCHAR quitW[] = {'q','u','i','t',0};
static const WCHAR exitW[] = {'e','x','i','t',0};
static const WCHAR pathW[] = {'p','a','t','h',0};
static const WCHAR classW[] = {'c','l','a','s','s',0};
static const WCHAR contextW[] = {'c','o','n','t','e','x','t',0};
if (argc != 4 || strcmpiW( argv[2], getW ))
const WCHAR *class;
const WCHAR *value;
int i;
if (argc == 1)
goto not_supported;
for (i = 1; i < argc && argv[i][0] == '/'; i++)
WINE_FIXME("command line switch %s not supported\n", debugstr_w(argv[i]));
if (i >= argc)
goto not_supported;
if (!strcmpiW( argv[i], quitW ) ||
!strcmpiW( argv[i], exitW ))
{
output_message( STRING_CMDLINE_NOT_SUPPORTED );
return -1;
return 0;
}
return query_prop( argv[1], argv[3] );
else if (!strcmpiW( argv[i], classW) ||
!strcmpiW( argv[i], contextW))
{
WINE_FIXME("command %s not supported\n", debugstr_w(argv[i]));
goto not_supported;
}
else if (!strcmpiW( argv[i], pathW))
{
if (++i >= argc)
{
output_message( STRING_INVALID_PATH );
return 1;
}
class = argv[i];
}
else
{
class = find_class( argv[i] );
if (!class)
{
output_message( STRING_ALIAS_NOT_FOUND );
return 1;
}
}
if (++i >= argc)
goto not_supported;
if (!strcmpiW( argv[i], getW))
{
if (++i >= argc)
goto not_supported;
value = argv[i];
return query_prop( class, value );
}
not_supported:
output_message( STRING_CMDLINE_NOT_SUPPORTED );
return 1;
}

View file

@ -21,3 +21,4 @@
#define STRING_CMDLINE_NOT_SUPPORTED 101
#define STRING_ALIAS_NOT_FOUND 102
#define STRING_INVALID_QUERY 103
#define STRING_INVALID_PATH 104

View file

@ -231,7 +231,7 @@ ReactOS shares the following programs with Winehq.
reactos/base/applications/cmdutils/cscript # Synced to WineStaging-1.9.4
reactos/base/applications/cmdutils/reg # Synced to WineStaging-1.9.11
reactos/base/applications/cmdutils/taskkill # Synced to WineStaging-1.9.4
reactos/base/applications/cmdutils/wmic # Synced to WineStaging-1.9.4
reactos/base/applications/cmdutils/wmic # Synced to WineStaging-1.9.11
reactos/base/applications/cmdutils/wscript # Synced to WineStaging-1.9.4
reactos/base/applications/cmdutils/xcopy # Synced to WineStaging-1.9.4
reactos/base/applications/games/winmine # Synced to WineStaging-1.9.4 with our own resources.