From ae9697f11745cfa2f2738627a7d8b0b81b421a19 Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Tue, 19 Jun 2012 10:19:59 +0200 Subject: [PATCH] wmic: Add support for querying class properties. --- configure | 2 +- configure.ac | 2 +- po/ar.po | 13 ++ po/bg.po | 14 +++ po/ca.po | 18 +++ po/cs.po | 17 +++ po/da.po | 18 +++ po/de.po | 18 +++ po/el.po | 15 +++ po/en.po | 12 ++ po/en_US.po | 12 ++ po/eo.po | 16 +++ po/es.po | 18 +++ po/fa.po | 13 ++ po/fi.po | 18 +++ po/fr.po | 18 +++ po/he.po | 17 +++ po/hi.po | 12 ++ po/hu.po | 18 +++ po/it.po | 18 +++ po/ja.po | 18 +++ po/ko.po | 18 +++ po/lt.po | 18 +++ po/ml.po | 12 ++ po/nb_NO.po | 17 +++ po/nl.po | 18 +++ po/or.po | 12 ++ po/pa.po | 12 ++ po/pl.po | 18 +++ po/pt_BR.po | 18 +++ po/pt_PT.po | 18 +++ po/rm.po | 12 ++ po/ro.po | 17 +++ po/ru.po | 18 +++ po/sk.po | 13 ++ po/sl.po | 18 +++ po/sr_RS@cyrillic.po | 17 +++ po/sr_RS@latin.po | 17 +++ po/sv.po | 18 +++ po/te.po | 12 ++ po/th.po | 13 ++ po/tr.po | 16 +++ po/uk.po | 18 +++ po/wa.po | 13 ++ po/wine.pot | 12 ++ po/zh_CN.po | 18 +++ po/zh_TW.po | 18 +++ programs/wmic/Makefile.in | 4 + programs/wmic/main.c | 243 ++++++++++++++++++++++++++++++++++++-- programs/wmic/wmic.h | 23 ++++ programs/wmic/wmic.rc | 28 +++++ 51 files changed, 1007 insertions(+), 9 deletions(-) create mode 100644 programs/wmic/wmic.h create mode 100644 programs/wmic/wmic.rc diff --git a/configure b/configure index 0849b84553c..c28f78083d8 100755 --- a/configure +++ b/configure @@ -15675,7 +15675,7 @@ wine_fn_config_program winhelp.exe16 enable_win16 install wine_fn_config_program winhlp32 enable_winhlp32 install,po wine_fn_config_program winoldap.mod16 enable_win16 install wine_fn_config_program winver enable_winver install -wine_fn_config_program wmic enable_wmic install +wine_fn_config_program wmic enable_wmic install,po wine_fn_config_program wordpad enable_wordpad install,po wine_fn_config_program write enable_write install,po wine_fn_config_program wscript enable_wscript install diff --git a/configure.ac b/configure.ac index a9b52f962f8..1753e147f94 100644 --- a/configure.ac +++ b/configure.ac @@ -3091,7 +3091,7 @@ WINE_CONFIG_PROGRAM(winhelp.exe16,enable_win16,[install]) WINE_CONFIG_PROGRAM(winhlp32,,[install,po]) WINE_CONFIG_PROGRAM(winoldap.mod16,enable_win16,[install]) WINE_CONFIG_PROGRAM(winver,,[install]) -WINE_CONFIG_PROGRAM(wmic,,[install]) +WINE_CONFIG_PROGRAM(wmic,,[install,po]) WINE_CONFIG_PROGRAM(wordpad,,[install,po]) WINE_CONFIG_PROGRAM(write,,[install,po]) WINE_CONFIG_PROGRAM(wscript,,[install]) diff --git a/po/ar.po b/po/ar.po index 7c5cc6d2f86..3c322d7da31 100644 --- a/po/ar.po +++ b/po/ar.po @@ -13272,6 +13272,19 @@ msgstr "" msgid "Help topics: " msgstr "" +#: wmic.rc:25 +msgid "Error: Command line not supported\n" +msgstr "" + +#: wmic.rc:26 +#, fuzzy +msgid "Error: Alias not found\n" +msgstr "تعذّر إيجاد '%s'." + +#: wmic.rc:27 +msgid "Error: Invalid query\n" +msgstr "" + #: wordpad.rc:28 #, fuzzy msgid "&New...\tCtrl+N" diff --git a/po/bg.po b/po/bg.po index 206bedd57c4..518598c6055 100644 --- a/po/bg.po +++ b/po/bg.po @@ -13475,6 +13475,20 @@ msgstr "" msgid "Help topics: " msgstr "" +#: wmic.rc:25 +msgid "Error: Command line not supported\n" +msgstr "" + +#: wmic.rc:26 +#, fuzzy +msgid "Error: Alias not found\n" +msgstr "Файлът не е намерен.\n" + +#: wmic.rc:27 +#, fuzzy +msgid "Error: Invalid query\n" +msgstr "Невалидни знаци в пътя.\n" + #: wordpad.rc:28 #, fuzzy msgid "&New...\tCtrl+N" diff --git a/po/ca.po b/po/ca.po index 637d5fd7c6c..b8e634dcdf4 100644 --- a/po/ca.po +++ b/po/ca.po @@ -13799,6 +13799,24 @@ msgstr "No es pot trobar una implementació de richedit...Avortant" msgid "Help topics: " msgstr "Temes d'ajuda: " +#: wmic.rc:25 +#, fuzzy +#| msgid "Error: Invalid command line parameters\n" +msgid "Error: Command line not supported\n" +msgstr "Error: Paràmetres de línia d'ordres no vàlids\n" + +#: wmic.rc:26 +#, fuzzy +#| msgid "Property set not found.\n" +msgid "Error: Alias not found\n" +msgstr "Conjunt de propietats no trobat.\n" + +#: wmic.rc:27 +#, fuzzy +#| msgid "Error: Invalid key name\n" +msgid "Error: Invalid query\n" +msgstr "Error: Nom de clau invàlid\n" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "&Nou...\tCtrl+N" diff --git a/po/cs.po b/po/cs.po index d2d6265da70..eaeeb9727c7 100644 --- a/po/cs.po +++ b/po/cs.po @@ -13831,6 +13831,23 @@ msgstr "Nemohu najít implementaci richedit... Přerušuji" msgid "Help topics: " msgstr "Témata nápovědy: " +#: wmic.rc:25 +#, fuzzy +#| msgid "Error: Invalid command line parameters\n" +msgid "Error: Command line not supported\n" +msgstr "Chyba: Neplatné parametry příkazové řádky\n" + +#: wmic.rc:26 +#, fuzzy +msgid "Error: Alias not found\n" +msgstr "Soubor nebyl nalezen.\n" + +#: wmic.rc:27 +#, fuzzy +#| msgid "Error: Invalid key name\n" +msgid "Error: Invalid query\n" +msgstr "Chyba: Neplatný název klíče\n" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "&Nový...\tCtrl+N" diff --git a/po/da.po b/po/da.po index 4b15fe28b52..5e8b2f61aab 100644 --- a/po/da.po +++ b/po/da.po @@ -13692,6 +13692,24 @@ msgstr "Kan ikke finde en 'richedit' implementering... Afbryder" msgid "Help topics: " msgstr "Hjælp emner: " +#: wmic.rc:25 +#, fuzzy +#| msgid "Error: Invalid command line parameters\n" +msgid "Error: Command line not supported\n" +msgstr "Fejl: Ugyldige kommando linje parametre\n" + +#: wmic.rc:26 +#, fuzzy +#| msgid "Property set not found.\n" +msgid "Error: Alias not found\n" +msgstr "Egenskabs sæt ikke fundet.\n" + +#: wmic.rc:27 +#, fuzzy +#| msgid "Error: Invalid key name\n" +msgid "Error: Invalid query\n" +msgstr "Fejl: Ugyldigt nøgle navn\n" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "&Ny...\tCtrl+N" diff --git a/po/de.po b/po/de.po index 47a5d3ce0c9..12d0ff9774b 100644 --- a/po/de.po +++ b/po/de.po @@ -13730,6 +13730,24 @@ msgstr "Die Richedit Implementation konnte nicht gefunden werden... Breche ab" msgid "Help topics: " msgstr "Hilfethemen: " +#: wmic.rc:25 +#, fuzzy +#| msgid "Error: Invalid command line parameters\n" +msgid "Error: Command line not supported\n" +msgstr "Fehler: Ungültige Befehlszeilenargumente\n" + +#: wmic.rc:26 +#, fuzzy +#| msgid "Property set not found.\n" +msgid "Error: Alias not found\n" +msgstr "Eigenschaften nicht gefunden.\n" + +#: wmic.rc:27 +#, fuzzy +#| msgid "Error: Invalid key name\n" +msgid "Error: Invalid query\n" +msgstr "Fehler: Ungültiger Schlüssel\n" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "&Neu...\tStrg+N" diff --git a/po/el.po b/po/el.po index d07cd4bd186..0b2ca60f3fa 100644 --- a/po/el.po +++ b/po/el.po @@ -13227,6 +13227,21 @@ msgstr "" msgid "Help topics: " msgstr "" +#: wmic.rc:25 +#, fuzzy +msgid "Error: Command line not supported\n" +msgstr "Επιλογές.\n" + +#: wmic.rc:26 +#, fuzzy +msgid "Error: Alias not found\n" +msgstr "Το αρχείο δε βρέθηκε.\n" + +#: wmic.rc:27 +#, fuzzy +msgid "Error: Invalid query\n" +msgstr "Μη έγγυρος(οι) χαρακτήρας(ες) στο μονοπάτι.\n" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "" diff --git a/po/en.po b/po/en.po index 5a9f76a4fa2..a37a00500a1 100644 --- a/po/en.po +++ b/po/en.po @@ -13633,6 +13633,18 @@ msgstr "Cannot find a richedit implementation... Aborting" msgid "Help topics: " msgstr "Help topics: " +#: wmic.rc:25 +msgid "Error: Command line not supported\n" +msgstr "Error: Command line not supported\n" + +#: wmic.rc:26 +msgid "Error: Alias not found\n" +msgstr "Error: Alias not found\n" + +#: wmic.rc:27 +msgid "Error: Invalid query\n" +msgstr "Error: Invalid query\n" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "&New...\tCtrl+N" diff --git a/po/en_US.po b/po/en_US.po index 16d971bdeb5..9e2fce47b0e 100644 --- a/po/en_US.po +++ b/po/en_US.po @@ -13638,6 +13638,18 @@ msgstr "Cannot find a richedit implementation... Aborting" msgid "Help topics: " msgstr "Help topics: " +#: wmic.rc:25 +msgid "Error: Command line not supported\n" +msgstr "Error: Command line not supported\n" + +#: wmic.rc:26 +msgid "Error: Alias not found\n" +msgstr "Error: Alias not found\n" + +#: wmic.rc:27 +msgid "Error: Invalid query\n" +msgstr "Error: Invalid query\n" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "&New...\tCtrl+N" diff --git a/po/eo.po b/po/eo.po index 86b7686897e..c421b1388d9 100644 --- a/po/eo.po +++ b/po/eo.po @@ -13036,6 +13036,22 @@ msgstr "Ne eblas trovi realigon de richedit... Ĉesigante" msgid "Help topics: " msgstr "Helpaj tempoj: " +#: wmic.rc:25 +msgid "Error: Command line not supported\n" +msgstr "" + +#: wmic.rc:26 +#, fuzzy +#| msgid "Property set not found.\n" +msgid "Error: Alias not found\n" +msgstr "Ecaro ne estis trovita.\n" + +#: wmic.rc:27 +#, fuzzy +#| msgid "Invalid query syntax.\n" +msgid "Error: Invalid query\n" +msgstr "Nevalida menda sintakso.\n" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "&Nova...\tStir+N" diff --git a/po/es.po b/po/es.po index a39d1d4502f..1f43239f14d 100644 --- a/po/es.po +++ b/po/es.po @@ -13798,6 +13798,24 @@ msgstr "No se pudo encontrar una implementación de richedit... Abortando" msgid "Help topics: " msgstr "Temas de ayuda: " +#: wmic.rc:25 +#, fuzzy +#| msgid "Error: Invalid command line parameters\n" +msgid "Error: Command line not supported\n" +msgstr "Error: parámetros de línea de comandos inválidos\n" + +#: wmic.rc:26 +#, fuzzy +#| msgid "Property set not found.\n" +msgid "Error: Alias not found\n" +msgstr "No se ha encontrado el conjunto de propiedades.\n" + +#: wmic.rc:27 +#, fuzzy +#| msgid "Error: Invalid key name\n" +msgid "Error: Invalid query\n" +msgstr "Error: nombre de clave inválido\n" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "&Nuevo...\tCtrl+N" diff --git a/po/fa.po b/po/fa.po index d85aef8ebbe..873a063429b 100644 --- a/po/fa.po +++ b/po/fa.po @@ -13273,6 +13273,19 @@ msgstr "" msgid "Help topics: " msgstr "" +#: wmic.rc:25 +msgid "Error: Command line not supported\n" +msgstr "" + +#: wmic.rc:26 +#, fuzzy +msgid "Error: Alias not found\n" +msgstr "'%s' پیدا نشد." + +#: wmic.rc:27 +msgid "Error: Invalid query\n" +msgstr "" + #: wordpad.rc:28 #, fuzzy msgid "&New...\tCtrl+N" diff --git a/po/fi.po b/po/fi.po index 1760919d4c7..b76bff5ba0b 100644 --- a/po/fi.po +++ b/po/fi.po @@ -13616,6 +13616,24 @@ msgstr "Richedit-toteutusta ei löytynyt... Keskeytetään" msgid "Help topics: " msgstr "Ohjeen otsikot: " +#: wmic.rc:25 +#, fuzzy +#| msgid "Error: Invalid command line parameters\n" +msgid "Error: Command line not supported\n" +msgstr "Virhe: Viallisia komentoriviparametreja\n" + +#: wmic.rc:26 +#, fuzzy +#| msgid "Property set not found.\n" +msgid "Error: Alias not found\n" +msgstr "Ominaisuusjoukkoa ei löytynyt.\n" + +#: wmic.rc:27 +#, fuzzy +#| msgid "Error: Invalid key name\n" +msgid "Error: Invalid query\n" +msgstr "Virhe: Viallinen avaimen nimi\n" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "&Uusi...\tCtrl+N" diff --git a/po/fr.po b/po/fr.po index 1ae905390dd..e3627f82fef 100644 --- a/po/fr.po +++ b/po/fr.po @@ -13803,6 +13803,24 @@ msgstr "Aucune implémentation richedit détectée... Abandon" msgid "Help topics: " msgstr "Rubriques d'aide : " +#: wmic.rc:25 +#, fuzzy +#| msgid "Error: Invalid command line parameters\n" +msgid "Error: Command line not supported\n" +msgstr "Erreur : paramètre de ligne de commande invalide\n" + +#: wmic.rc:26 +#, fuzzy +#| msgid "Property set not found.\n" +msgid "Error: Alias not found\n" +msgstr "Jeu de propriétés introuvable.\n" + +#: wmic.rc:27 +#, fuzzy +#| msgid "Error: Invalid key name\n" +msgid "Error: Invalid query\n" +msgstr "Erreur : nom de clé invalide\n" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "&Nouveau...\tCtrl+N" diff --git a/po/he.po b/po/he.po index b0578ebf071..081838f57a9 100644 --- a/po/he.po +++ b/po/he.po @@ -13848,6 +13848,23 @@ msgstr "לא ניתן למצוא יישום של richedit... התכנית תצא msgid "Help topics: " msgstr "נושאי העזרה: " +#: wmic.rc:25 +#, fuzzy +#| msgid "Error: Invalid command line parameters\n" +msgid "Error: Command line not supported\n" +msgstr "Error: Invalid command line parameters\n" + +#: wmic.rc:26 +#, fuzzy +msgid "Error: Alias not found\n" +msgstr "PATH not found.\n" + +#: wmic.rc:27 +#, fuzzy +#| msgid "Error: Invalid key name\n" +msgid "Error: Invalid query\n" +msgstr "Error: Invalid key name\n" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "&חדש...\tCtrl+N" diff --git a/po/hi.po b/po/hi.po index 9b924c01de6..5b697925b9e 100644 --- a/po/hi.po +++ b/po/hi.po @@ -13049,6 +13049,18 @@ msgstr "" msgid "Help topics: " msgstr "" +#: wmic.rc:25 +msgid "Error: Command line not supported\n" +msgstr "" + +#: wmic.rc:26 +msgid "Error: Alias not found\n" +msgstr "" + +#: wmic.rc:27 +msgid "Error: Invalid query\n" +msgstr "" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "" diff --git a/po/hu.po b/po/hu.po index d76f24a99ff..d0c02d1467b 100644 --- a/po/hu.po +++ b/po/hu.po @@ -13703,6 +13703,24 @@ msgstr "Nem található richedit megvalósítás... Megszakítás" msgid "Help topics: " msgstr "Súgó témák: " +#: wmic.rc:25 +#, fuzzy +#| msgid "Error: Invalid command line parameters\n" +msgid "Error: Command line not supported\n" +msgstr "Hiba: Érvénytelen parancssor paraméterek\n" + +#: wmic.rc:26 +#, fuzzy +#| msgid "Property set not found.\n" +msgid "Error: Alias not found\n" +msgstr "Beállítás nem található.\n" + +#: wmic.rc:27 +#, fuzzy +#| msgid "Error: Invalid key name\n" +msgid "Error: Invalid query\n" +msgstr "Hiba: Érvénytelen kulcsnév\n" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "&Új...\tCtrl+N" diff --git a/po/it.po b/po/it.po index 144a39d4984..a6875357120 100644 --- a/po/it.po +++ b/po/it.po @@ -13795,6 +13795,24 @@ msgstr "" msgid "Help topics: " msgstr "Argomenti di aiuto: " +#: wmic.rc:25 +#, fuzzy +#| msgid "Error: Invalid command line parameters\n" +msgid "Error: Command line not supported\n" +msgstr "Errore: parametri della linea di comando non validi\n" + +#: wmic.rc:26 +#, fuzzy +#| msgid "Property set not found.\n" +msgid "Error: Alias not found\n" +msgstr "Insieme di proprietà non trovato.\n" + +#: wmic.rc:27 +#, fuzzy +#| msgid "Error: Invalid key name\n" +msgid "Error: Invalid query\n" +msgstr "Errore: nome della chiave non valido\n" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "&Nuovo...\tCtrl+N" diff --git a/po/ja.po b/po/ja.po index f2be7cfdfdf..d8de95570eb 100644 --- a/po/ja.po +++ b/po/ja.po @@ -13631,6 +13631,24 @@ msgstr "Richedit が見つかりません... 終了します" msgid "Help topics: " msgstr "ヘルプ トピック: " +#: wmic.rc:25 +#, fuzzy +#| msgid "Error: Invalid command line parameters\n" +msgid "Error: Command line not supported\n" +msgstr "エラー: コマンド ライン引数が無効です\n" + +#: wmic.rc:26 +#, fuzzy +#| msgid "Property set not found.\n" +msgid "Error: Alias not found\n" +msgstr "プロパティ セットが見つかりません。\n" + +#: wmic.rc:27 +#, fuzzy +#| msgid "Error: Invalid key name\n" +msgid "Error: Invalid query\n" +msgstr "エラー: キー名が無効です\n" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "新規作成(&N)...\tCtrl+N" diff --git a/po/ko.po b/po/ko.po index a25f140c5e7..2c13c69ed66 100644 --- a/po/ko.po +++ b/po/ko.po @@ -13598,6 +13598,24 @@ msgstr "richedit 구현을 찾을수 없습니다... 취소중" msgid "Help topics: " msgstr "도움말 목차: " +#: wmic.rc:25 +#, fuzzy +#| msgid "Error: Invalid command line parameters\n" +msgid "Error: Command line not supported\n" +msgstr "오류:올바르지 않은 명령라인 매개변수\n" + +#: wmic.rc:26 +#, fuzzy +#| msgid "Property set not found.\n" +msgid "Error: Alias not found\n" +msgstr "속성 세트를 찾을 수 없습니다.\n" + +#: wmic.rc:27 +#, fuzzy +#| msgid "Error: Invalid key name\n" +msgid "Error: Invalid query\n" +msgstr "오류: 올바르지 않은 키 이름\n" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "새 파일(&N)...\tCtrl+N" diff --git a/po/lt.po b/po/lt.po index 9bfd888ccfe..f4703b05bb4 100644 --- a/po/lt.po +++ b/po/lt.po @@ -13664,6 +13664,24 @@ msgstr "Nepavyko rasti RichEdit realizacijos... Nutraukiama" msgid "Help topics: " msgstr "Žinyno temos: " +#: wmic.rc:25 +#, fuzzy +#| msgid "Error: Invalid command line parameters\n" +msgid "Error: Command line not supported\n" +msgstr "Klaida: Netinkami komandos eilutės parametrai\n" + +#: wmic.rc:26 +#, fuzzy +#| msgid "Property set not found.\n" +msgid "Error: Alias not found\n" +msgstr "Savybių aibė nerasta.\n" + +#: wmic.rc:27 +#, fuzzy +#| msgid "Error: Invalid key name\n" +msgid "Error: Invalid query\n" +msgstr "Klaida: Netinkamas rakto vardas\n" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "&Naujas...\tVald+N" diff --git a/po/ml.po b/po/ml.po index c39cf3564ef..95a42c9af46 100644 --- a/po/ml.po +++ b/po/ml.po @@ -13049,6 +13049,18 @@ msgstr "" msgid "Help topics: " msgstr "" +#: wmic.rc:25 +msgid "Error: Command line not supported\n" +msgstr "" + +#: wmic.rc:26 +msgid "Error: Alias not found\n" +msgstr "" + +#: wmic.rc:27 +msgid "Error: Invalid query\n" +msgstr "" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "" diff --git a/po/nb_NO.po b/po/nb_NO.po index 1c292393dc3..6f709efa4b5 100644 --- a/po/nb_NO.po +++ b/po/nb_NO.po @@ -14059,6 +14059,23 @@ msgstr "Klarte ikke finne richedit; avbryter" msgid "Help topics: " msgstr "Emner i Hjelp: " +#: wmic.rc:25 +#, fuzzy +#| msgid "Error: Invalid command line parameters\n" +msgid "Error: Command line not supported\n" +msgstr "Feil: Ugyldige parametere på kommandolinjen\n" + +#: wmic.rc:26 +#, fuzzy +msgid "Error: Alias not found\n" +msgstr "Fant ikke prosedyren.\n" + +#: wmic.rc:27 +#, fuzzy +#| msgid "Error: Invalid key name\n" +msgid "Error: Invalid query\n" +msgstr "Feil: Ugyldig nøkkelnavn\n" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "&Ny...\tCtrl+N" diff --git a/po/nl.po b/po/nl.po index 8b230a6e120..7c82f8f0563 100644 --- a/po/nl.po +++ b/po/nl.po @@ -13896,6 +13896,24 @@ msgstr "Kan geen richedit implementatie vinden... Actie afgebroken" msgid "Help topics: " msgstr "Help-onderwerpen: " +#: wmic.rc:25 +#, fuzzy +#| msgid "Error: Invalid command line parameters\n" +msgid "Error: Command line not supported\n" +msgstr "Fout: Foutieve commandoregel-parameters\n" + +#: wmic.rc:26 +#, fuzzy +#| msgid "Property set not found.\n" +msgid "Error: Alias not found\n" +msgstr "Verzameling eigenschappen niet gevonden.\n" + +#: wmic.rc:27 +#, fuzzy +#| msgid "Error: Invalid key name\n" +msgid "Error: Invalid query\n" +msgstr "Fout: Foutieve sleutelnaam\n" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "&Nieuw...\tCtrl+N" diff --git a/po/or.po b/po/or.po index bfe03eecc48..4f3dd8829ca 100644 --- a/po/or.po +++ b/po/or.po @@ -13049,6 +13049,18 @@ msgstr "" msgid "Help topics: " msgstr "" +#: wmic.rc:25 +msgid "Error: Command line not supported\n" +msgstr "" + +#: wmic.rc:26 +msgid "Error: Alias not found\n" +msgstr "" + +#: wmic.rc:27 +msgid "Error: Invalid query\n" +msgstr "" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "" diff --git a/po/pa.po b/po/pa.po index b255ca7bb56..e612ecf2a87 100644 --- a/po/pa.po +++ b/po/pa.po @@ -13049,6 +13049,18 @@ msgstr "" msgid "Help topics: " msgstr "" +#: wmic.rc:25 +msgid "Error: Command line not supported\n" +msgstr "" + +#: wmic.rc:26 +msgid "Error: Alias not found\n" +msgstr "" + +#: wmic.rc:27 +msgid "Error: Invalid query\n" +msgstr "" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "" diff --git a/po/pl.po b/po/pl.po index b2c72bcd0f2..9b4b70df63d 100644 --- a/po/pl.po +++ b/po/pl.po @@ -13698,6 +13698,24 @@ msgstr "" msgid "Help topics: " msgstr "Tematy pomocy: " +#: wmic.rc:25 +#, fuzzy +#| msgid "Error: Invalid command line parameters\n" +msgid "Error: Command line not supported\n" +msgstr "Błąd: Niewłaściwe parametry wiersza poleceń\n" + +#: wmic.rc:26 +#, fuzzy +#| msgid "Property set not found.\n" +msgid "Error: Alias not found\n" +msgstr "Nie znaleziono zestawu właściwości.\n" + +#: wmic.rc:27 +#, fuzzy +#| msgid "Error: Invalid key name\n" +msgid "Error: Invalid query\n" +msgstr "Błąd: Niewłaściwa nazwa klucza\n" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "&Nowy...\tCtrl+N" diff --git a/po/pt_BR.po b/po/pt_BR.po index 3a9c36890f9..419b3338e82 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -13777,6 +13777,24 @@ msgstr "Não foi possível encontrar uma implementação do richedit... Abortand msgid "Help topics: " msgstr "Tópicos de ajuda: " +#: wmic.rc:25 +#, fuzzy +#| msgid "Error: Invalid command line parameters\n" +msgid "Error: Command line not supported\n" +msgstr "Erro: Parâmetros da linha de comandos inválidos\n" + +#: wmic.rc:26 +#, fuzzy +#| msgid "Property set not found.\n" +msgid "Error: Alias not found\n" +msgstr "Propriedade não encontrada.\n" + +#: wmic.rc:27 +#, fuzzy +#| msgid "Error: Invalid key name\n" +msgid "Error: Invalid query\n" +msgstr "Erro: Nome de chave inválido\n" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "&Novo...\tCtrl+N" diff --git a/po/pt_PT.po b/po/pt_PT.po index 494c58d7e19..8e8a1b679ff 100644 --- a/po/pt_PT.po +++ b/po/pt_PT.po @@ -13709,6 +13709,24 @@ msgstr "Não foi possível encontrar uma implementação do richedit... A aborta msgid "Help topics: " msgstr "Tópicos de ajuda: " +#: wmic.rc:25 +#, fuzzy +#| msgid "Error: Invalid command line parameters\n" +msgid "Error: Command line not supported\n" +msgstr "Erro: Parâmetros da linha de comandos inválidos\n" + +#: wmic.rc:26 +#, fuzzy +#| msgid "Property set not found.\n" +msgid "Error: Alias not found\n" +msgstr "Conjunto de propriedades não encontrado.\n" + +#: wmic.rc:27 +#, fuzzy +#| msgid "Error: Invalid key name\n" +msgid "Error: Invalid query\n" +msgstr "Erro: Nome de chave inválido\n" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "&Novo...\tCtrl+N" diff --git a/po/rm.po b/po/rm.po index f67de7d7dbb..a6d6589cb03 100644 --- a/po/rm.po +++ b/po/rm.po @@ -13141,6 +13141,18 @@ msgstr "" msgid "Help topics: " msgstr "" +#: wmic.rc:25 +msgid "Error: Command line not supported\n" +msgstr "" + +#: wmic.rc:26 +msgid "Error: Alias not found\n" +msgstr "" + +#: wmic.rc:27 +msgid "Error: Invalid query\n" +msgstr "" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "" diff --git a/po/ro.po b/po/ro.po index 93b4f0a5df8..0cf49219b2d 100644 --- a/po/ro.po +++ b/po/ro.po @@ -13891,6 +13891,23 @@ msgstr "Nu am găsit o implementare pentru richedit... Abandonez" msgid "Help topics: " msgstr "Subiecte de ajutor: " +#: wmic.rc:25 +#, fuzzy +#| msgid "Error: Invalid command line parameters\n" +msgid "Error: Command line not supported\n" +msgstr "Eroare: Parametri nevalizi pentru linia de comandă\n" + +#: wmic.rc:26 +#, fuzzy +msgid "Error: Alias not found\n" +msgstr "PATH negăsită.\n" + +#: wmic.rc:27 +#, fuzzy +#| msgid "Error: Invalid key name\n" +msgid "Error: Invalid query\n" +msgstr "Eroare: Nume de cheie nevalid\n" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "&Nou...\tCtrl+N" diff --git a/po/ru.po b/po/ru.po index d74550938eb..2d7d6ef8948 100644 --- a/po/ru.po +++ b/po/ru.po @@ -13659,6 +13659,24 @@ msgstr "Не могу найти richedit" msgid "Help topics: " msgstr "Содержание: " +#: wmic.rc:25 +#, fuzzy +#| msgid "Error: Invalid command line parameters\n" +msgid "Error: Command line not supported\n" +msgstr "Ошибка: неправильные параметры командной строки\n" + +#: wmic.rc:26 +#, fuzzy +#| msgid "Property set not found.\n" +msgid "Error: Alias not found\n" +msgstr "Набор свойств не найден.\n" + +#: wmic.rc:27 +#, fuzzy +#| msgid "Error: Invalid key name\n" +msgid "Error: Invalid query\n" +msgstr "Ошибка: неправильное имя раздела\n" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "Созд&ать...\tCtrl+N" diff --git a/po/sk.po b/po/sk.po index 0fe13f705d8..ab945bbcd74 100644 --- a/po/sk.po +++ b/po/sk.po @@ -13230,6 +13230,19 @@ msgstr "" msgid "Help topics: " msgstr "" +#: wmic.rc:25 +msgid "Error: Command line not supported\n" +msgstr "" + +#: wmic.rc:26 +#, fuzzy +msgid "Error: Alias not found\n" +msgstr "Súbor nenájdený.\n" + +#: wmic.rc:27 +msgid "Error: Invalid query\n" +msgstr "" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "&Nový...\tCtrl+N" diff --git a/po/sl.po b/po/sl.po index 5fe22d07adf..e9705b52055 100644 --- a/po/sl.po +++ b/po/sl.po @@ -13722,6 +13722,24 @@ msgstr "Ni mogoče najti knjižnice richedit ... Prekinjanje" msgid "Help topics: " msgstr "Teme pomoči: " +#: wmic.rc:25 +#, fuzzy +#| msgid "Error: Invalid command line parameters\n" +msgid "Error: Command line not supported\n" +msgstr "Napaka: neveljaven parameter v ukazni vrstici\n" + +#: wmic.rc:26 +#, fuzzy +#| msgid "Property set not found.\n" +msgid "Error: Alias not found\n" +msgstr "Nastavljene lastnosti ni mogoče najti.\n" + +#: wmic.rc:27 +#, fuzzy +#| msgid "Error: Invalid key name\n" +msgid "Error: Invalid query\n" +msgstr "Napaka: neveljavno ime ključa\n" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "&Nova ...\tCtrl+N" diff --git a/po/sr_RS@cyrillic.po b/po/sr_RS@cyrillic.po index f0bbb9371d6..da4a1d4fd91 100644 --- a/po/sr_RS@cyrillic.po +++ b/po/sr_RS@cyrillic.po @@ -13770,6 +13770,23 @@ msgstr "" msgid "Help topics: " msgstr "" +#: wmic.rc:25 +#, fuzzy +#| msgid "Error: Invalid command line parameters\n" +msgid "Error: Command line not supported\n" +msgstr "" +"Грешка: унесени су непознати или неисправни параметри наредбене линије\n" + +#: wmic.rc:26 +#, fuzzy +msgid "Error: Alias not found\n" +msgstr "Датотека није пронађена.\n" + +#: wmic.rc:27 +#, fuzzy +msgid "Error: Invalid query\n" +msgstr "Неисправна синтакса.\n" + #: wordpad.rc:28 #, fuzzy msgid "&New...\tCtrl+N" diff --git a/po/sr_RS@latin.po b/po/sr_RS@latin.po index 7f08c05b031..abedea16318 100644 --- a/po/sr_RS@latin.po +++ b/po/sr_RS@latin.po @@ -13911,6 +13911,23 @@ msgstr "Ne mogu naći richedit ubacen... Prekidam" msgid "Help topics: " msgstr "Teme pomoći: " +#: wmic.rc:25 +#, fuzzy +#| msgid "Error: Invalid command line parameters\n" +msgid "Error: Command line not supported\n" +msgstr "" +"Greška: uneseni su nepoznati ili neispravni parametri naredbene linije\n" + +#: wmic.rc:26 +#, fuzzy +msgid "Error: Alias not found\n" +msgstr "Datoteka nije pronađena.\n" + +#: wmic.rc:27 +#, fuzzy +msgid "Error: Invalid query\n" +msgstr "Neispravna sintaksa.\n" + #: wordpad.rc:28 #, fuzzy msgid "&New...\tCtrl+N" diff --git a/po/sv.po b/po/sv.po index 3036be78f9d..e00a84fd6e6 100644 --- a/po/sv.po +++ b/po/sv.po @@ -13566,6 +13566,24 @@ msgstr "Kan inte hitta en implementation av richedit... Avslutar" msgid "Help topics: " msgstr "Hjälprubriker: " +#: wmic.rc:25 +#, fuzzy +#| msgid "Error: Invalid command line parameters\n" +msgid "Error: Command line not supported\n" +msgstr "Fel: ogiltiga kommandoradsparametrar\n" + +#: wmic.rc:26 +#, fuzzy +#| msgid "Property set not found.\n" +msgid "Error: Alias not found\n" +msgstr "Egenskapsmängden hittades inte.\n" + +#: wmic.rc:27 +#, fuzzy +#| msgid "Error: Invalid key name\n" +msgid "Error: Invalid query\n" +msgstr "Fel: ogiltigt nyckelnamn\n" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "&Nytt...\tCtrl+N" diff --git a/po/te.po b/po/te.po index 3730ab31f1e..ee6537f7b99 100644 --- a/po/te.po +++ b/po/te.po @@ -13049,6 +13049,18 @@ msgstr "" msgid "Help topics: " msgstr "" +#: wmic.rc:25 +msgid "Error: Command line not supported\n" +msgstr "" + +#: wmic.rc:26 +msgid "Error: Alias not found\n" +msgstr "" + +#: wmic.rc:27 +msgid "Error: Invalid query\n" +msgstr "" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "" diff --git a/po/th.po b/po/th.po index 74b5f2f748d..6bb9bcb45ab 100644 --- a/po/th.po +++ b/po/th.po @@ -13284,6 +13284,19 @@ msgstr "" msgid "Help topics: " msgstr "" +#: wmic.rc:25 +msgid "Error: Command line not supported\n" +msgstr "" + +#: wmic.rc:26 +#, fuzzy +msgid "Error: Alias not found\n" +msgstr "ไม่พบแฟ้ม.\n" + +#: wmic.rc:27 +msgid "Error: Invalid query\n" +msgstr "" + #: wordpad.rc:28 #, fuzzy msgid "&New...\tCtrl+N" diff --git a/po/tr.po b/po/tr.po index 7a0a51626d6..593bfea9bd5 100644 --- a/po/tr.po +++ b/po/tr.po @@ -13359,6 +13359,22 @@ msgstr "" msgid "Help topics: " msgstr "Yardım konuları: " +#: wmic.rc:25 +msgid "Error: Command line not supported\n" +msgstr "" + +#: wmic.rc:26 +#, fuzzy +#| msgid "Entry not found.\n" +msgid "Error: Alias not found\n" +msgstr "Girdi bulunamadı.\n" + +#: wmic.rc:27 +#, fuzzy +#| msgid "Invalid entry.\n" +msgid "Error: Invalid query\n" +msgstr "Geçersiz giriş.\n" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "&Yeni...\tCtrl+N" diff --git a/po/uk.po b/po/uk.po index 669b3135b7c..eeef26014f1 100644 --- a/po/uk.po +++ b/po/uk.po @@ -13701,6 +13701,24 @@ msgstr "Не можу знайти richedit... Скасовую" msgid "Help topics: " msgstr "Розділи Довідки: " +#: wmic.rc:25 +#, fuzzy +#| msgid "Error: Invalid command line parameters\n" +msgid "Error: Command line not supported\n" +msgstr "Помилка: неправильні параметри командного рядка\n" + +#: wmic.rc:26 +#, fuzzy +#| msgid "Property set not found.\n" +msgid "Error: Alias not found\n" +msgstr "Набір властивостей не знайдено.\n" + +#: wmic.rc:27 +#, fuzzy +#| msgid "Error: Invalid key name\n" +msgid "Error: Invalid query\n" +msgstr "Помилка: неправильне ім'я ключа\n" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "&Новий...\tCtrl+N" diff --git a/po/wa.po b/po/wa.po index e4acee01fc2..cf94a25bd20 100644 --- a/po/wa.po +++ b/po/wa.po @@ -13215,6 +13215,19 @@ msgstr "" msgid "Help topics: " msgstr "" +#: wmic.rc:25 +msgid "Error: Command line not supported\n" +msgstr "" + +#: wmic.rc:26 +#, fuzzy +msgid "Error: Alias not found\n" +msgstr "'%s' pout nén esse trové." + +#: wmic.rc:27 +msgid "Error: Invalid query\n" +msgstr "" + #: wordpad.rc:28 #, fuzzy msgid "&New...\tCtrl+N" diff --git a/po/wine.pot b/po/wine.pot index 43ffa2489a9..76a1f68e09d 100644 --- a/po/wine.pot +++ b/po/wine.pot @@ -12971,6 +12971,18 @@ msgstr "" msgid "Help topics: " msgstr "" +#: wmic.rc:25 +msgid "Error: Command line not supported\n" +msgstr "" + +#: wmic.rc:26 +msgid "Error: Alias not found\n" +msgstr "" + +#: wmic.rc:27 +msgid "Error: Invalid query\n" +msgstr "" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "" diff --git a/po/zh_CN.po b/po/zh_CN.po index 9fc58066e33..293b27350d5 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -13131,6 +13131,24 @@ msgstr "找不到 richedit 的实现……终止" msgid "Help topics: " msgstr "帮助主题: " +#: wmic.rc:25 +#, fuzzy +#| msgid "Operation not supported.\n" +msgid "Error: Command line not supported\n" +msgstr "不支持此操作。\n" + +#: wmic.rc:26 +#, fuzzy +#| msgid "Property set not found.\n" +msgid "Error: Alias not found\n" +msgstr "找不到属性集。\n" + +#: wmic.rc:27 +#, fuzzy +#| msgid "Invalid query syntax.\n" +msgid "Error: Invalid query\n" +msgstr "请求语法无效。\n" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "新建(&N)...\tCtrl+N" diff --git a/po/zh_TW.po b/po/zh_TW.po index 208301f5828..f121d071198 100644 --- a/po/zh_TW.po +++ b/po/zh_TW.po @@ -13070,6 +13070,24 @@ msgstr "找不到 richedit... 終止" msgid "Help topics: " msgstr "說明主題:" +#: wmic.rc:25 +#, fuzzy +#| msgid "Extended attributes not supported.\n" +msgid "Error: Command line not supported\n" +msgstr "不支援延伸屬性。\n" + +#: wmic.rc:26 +#, fuzzy +#| msgid "Sector not found.\n" +msgid "Error: Alias not found\n" +msgstr "找不到磁區。\n" + +#: wmic.rc:27 +#, fuzzy +#| msgid "Invalid key.\n" +msgid "Error: Invalid query\n" +msgstr "無效的機碼。\n" + #: wordpad.rc:28 msgid "&New...\tCtrl+N" msgstr "新增(&N)...\tCtrl+N" diff --git a/programs/wmic/Makefile.in b/programs/wmic/Makefile.in index f7c7ebcccc9..aba9a28325f 100644 --- a/programs/wmic/Makefile.in +++ b/programs/wmic/Makefile.in @@ -1,7 +1,11 @@ MODULE = wmic.exe APPMODE = -mconsole -municode +IMPORTS = oleaut32 ole32 user32 C_SRCS = \ main.c +RC_SRCS = wmic.rc +PO_SRCS = wmic.rc + @MAKE_PROG_RULES@ diff --git a/programs/wmic/main.c b/programs/wmic/main.c index ba37017a284..8d89bf4bcf7 100644 --- a/programs/wmic/main.c +++ b/programs/wmic/main.c @@ -1,5 +1,6 @@ /* * Copyright 2010 Louis Lenders + * Copyright 2012 Hans Leidekker for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -16,18 +17,246 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#define COBJMACROS + +#include +#include "windows.h" +#include "ocidl.h" +#include "initguid.h" +#include "objidl.h" +#include "wbemcli.h" +#include "wmic.h" + #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(wmic); +static const WCHAR biosW[] = + {'b','i','o','s',0}; +static const WCHAR computersystemW[] = + {'c','o','m','p','u','t','e','r','s','y','s','t','e','m',0}; +static const WCHAR cpuW[] = + {'c','p','u',0}; +static const WCHAR logicaldiskW[] = + {'L','o','g','i','c','a','l','D','i','s','k',0}; +static const WCHAR nicW[] = + {'n','i','c',0}; +static const WCHAR osW[] = + {'o','s',0}; +static const WCHAR processW[] = + {'p','r','o','c','e','s','s',0}; + +static const WCHAR win32_biosW[] = + {'W','i','n','3','2','_','B','I','O','S',0}; +static const WCHAR win32_computersystemW[] = + {'W','i','n','3','2','_','C','o','m','p','u','t','e','r','S','y','s','t','e','m',0}; +static const WCHAR win32_logicaldiskW[] = + {'W','i','n','3','2','_','L','o','g','i','c','a','l','D','i','s','k',0}; +static const WCHAR win32_networkadapterW[] = + {'W','i','n','3','2','_','N','e','t','w','o','r','k','A','d','a','p','t','e','r',0}; +static const WCHAR win32_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 win32_processW[] = + {'W','i','n','3','2','_','P','r','o','c','e','s','s',0}; +static const WCHAR win32_processorW[] = + {'W','i','n','3','2','_','P','r','o','c','e','s','s','o','r',0}; + +static const struct +{ + const WCHAR *alias; + const WCHAR *class; +} +alias_map[] = +{ + { biosW, win32_biosW }, + { computersystemW, win32_computersystemW }, + { cpuW, win32_processorW }, + { logicaldiskW, win32_logicaldiskW }, + { nicW, win32_networkadapterW }, + { osW, win32_operatingsystemW }, + { processW, win32_processW } +}; + +static const WCHAR *find_class( const WCHAR *alias ) +{ + unsigned int i; + + for (i = 0; i < sizeof(alias_map)/sizeof(alias_map[0]); i++) + { + if (!strcmpiW( alias, alias_map[i].alias )) return alias_map[i].class; + } + return NULL; +} + +static inline WCHAR *strdupW( const WCHAR *src ) +{ + WCHAR *dst; + if (!src) return NULL; + if (!(dst = HeapAlloc( GetProcessHeap(), 0, (strlenW( src ) + 1) * sizeof(WCHAR) ))) return NULL; + strcpyW( dst, src ); + return dst; +} + +static WCHAR *find_prop( IWbemClassObject *class, const WCHAR *prop ) +{ + SAFEARRAY *sa; + WCHAR *ret = NULL; + LONG i, last_index = 0; + BSTR str; + + if (IWbemClassObject_GetNames( class, NULL, WBEM_FLAG_ALWAYS, NULL, &sa ) != S_OK) return NULL; + + SafeArrayGetUBound( sa, 1, &last_index ); + for (i = 0; i <= last_index; i++) + { + SafeArrayGetElement( sa, &i, &str ); + if (!strcmpiW( str, prop )) + { + ret = strdupW( str ); + break; + } + } + SafeArrayDestroy( sa ); + return ret; +} + +static int output_string( const WCHAR *msg, ... ) +{ + va_list va_args; + int wlen; + DWORD count, ret; + WCHAR buffer[8192]; + + va_start( va_args, msg ); + vsprintfW( buffer, msg, va_args ); + va_end( va_args ); + + wlen = strlenW( buffer ); + ret = WriteConsoleW( GetStdHandle(STD_OUTPUT_HANDLE), buffer, wlen, &count, NULL ); + if (!ret) + { + DWORD len; + char *msgA; + + /* On Windows WriteConsoleW() fails if the output is redirected. So fall + * back to WriteFile(), assuming the console encoding is still the right + * one in that case. + */ + len = WideCharToMultiByte( GetConsoleOutputCP(), 0, buffer, wlen, NULL, 0, NULL, NULL ); + if (!(msgA = HeapAlloc( GetProcessHeap(), 0, len * sizeof(char) ))) return 0; + + WideCharToMultiByte( GetConsoleOutputCP(), 0, buffer, wlen, msgA, len, NULL, NULL ); + WriteFile( GetStdHandle(STD_OUTPUT_HANDLE), msgA, len, &count, FALSE ); + HeapFree( GetProcessHeap(), 0, msgA ); + } + return count; +} + +static int output_message( int msg ) +{ + static const WCHAR fmtW[] = {'%','s',0}; + WCHAR buffer[8192]; + + LoadStringW( GetModuleHandleW(NULL), msg, buffer, sizeof(buffer)/sizeof(WCHAR) ); + return output_string( fmtW, buffer ); +} + +static int query_prop( const WCHAR *alias, 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}; + static const WCHAR wqlW[] = {'W','Q','L',0}; + static const WCHAR newlineW[] = {'\n',0}; + static const WCHAR fmtW[] = {'%','s','\n',0}; + HRESULT hr; + IWbemLocator *locator = NULL; + IWbemServices *services = NULL; + 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)); + + 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 ); + + hr = CoCreateInstance( &CLSID_WbemLocator, NULL, CLSCTX_INPROC_SERVER, &IID_IWbemLocator, + (void **)&locator ); + if (hr != S_OK) goto done; + + if (!(path = SysAllocString( cimv2W ))) goto done; + hr = IWbemLocator_ConnectServer( locator, path, NULL, NULL, NULL, 0, NULL, NULL, &services ); + if (hr != S_OK) goto done; + + len = strlenW( class ) + sizeof(select_allW) / sizeof(select_allW[0]); + if (!(query = SysAllocStringLen( NULL, len ))) goto done; + strcpyW( query, select_allW ); + strcatW( query, class ); + + if (!(wql = SysAllocString( wqlW ))) goto done; + hr = IWbemServices_ExecQuery( services, wql, query, flags, NULL, &result ); + if (hr != S_OK) goto done; + + for (;;) + { + IWbemClassObject *obj; + ULONG count; + VARIANT v; + + IEnumWbemClassObject_Next( result, WBEM_INFINITE, 1, &obj, &count ); + if (!count) break; + + if (first) + { + if (!(prop = find_prop( obj, propname ))) + { + output_message( STRING_INVALID_QUERY ); + goto done; + } + output_string( fmtW, prop ); + first = FALSE; + } + if (IWbemClassObject_Get( obj, prop, 0, &v, NULL, NULL ) == WBEM_S_NO_ERROR) + { + output_string( fmtW, V_BSTR( &v ) ); + VariantClear( &v ); + } + IWbemClassObject_Release( obj ); + } + output_string( newlineW ); + ret = 0; + +done: + if (result) IEnumWbemClassObject_Release( result ); + if (services) IWbemServices_Release( services ); + if (locator) IWbemLocator_Release( locator ); + SysFreeString( path ); + SysFreeString( query ); + SysFreeString( wql ); + HeapFree( GetProcessHeap(), 0, prop ); + CoUninitialize(); + return ret; +} + int wmain(int argc, WCHAR *argv[]) { - int i; + static const WCHAR getW[] = {'g','e','t',0}; - WINE_FIXME("stub:"); - for (i = 0; i < argc; i++) - WINE_FIXME(" %s", wine_dbgstr_w(argv[i])); - WINE_FIXME("\n"); - - return 0; + if (argc != 4 || strcmpiW( argv[2], getW )) + { + output_message( STRING_CMDLINE_NOT_SUPPORTED ); + return -1; + } + return query_prop( argv[1], argv[3] ); } diff --git a/programs/wmic/wmic.h b/programs/wmic/wmic.h new file mode 100644 index 00000000000..ee56d8e9642 --- /dev/null +++ b/programs/wmic/wmic.h @@ -0,0 +1,23 @@ +/* + * Copyright 2012 Hans Leidekker for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include + +#define STRING_CMDLINE_NOT_SUPPORTED 101 +#define STRING_ALIAS_NOT_FOUND 102 +#define STRING_INVALID_QUERY 103 diff --git a/programs/wmic/wmic.rc b/programs/wmic/wmic.rc new file mode 100644 index 00000000000..d9087900ed7 --- /dev/null +++ b/programs/wmic/wmic.rc @@ -0,0 +1,28 @@ +/* + * Copyright 2012 Hans Leidekker for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "wmic.h" + +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT + +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" +}