Rev 255 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 255 | Rev 256 | ||
---|---|---|---|
Line 1867... | Line 1867... | ||
1867 | else return result; //ïîëó÷èëè íå êîððåêòíûé îòâåò |
1867 | else return result; //ïîëó÷èëè íå êîððåêòíûé îòâåò |
1868 | int m; |
1868 | int m; |
1869 | m++; |
1869 | m++; |
1870 | }
|
1870 | }
|
1871 | else { |
1871 | else { |
- | 1872 | ||
- | 1873 | wmiThread.terminate(); |
|
- | 1874 | /*********************
|
|
1872 | wmiThread.stop(); |
1875 | wmiThread.stop();
|
1873 | ok = wmiThread.wait(10000); |
1876 | ok = wmiThread.wait(10000);
|
1874 | int k; |
1877 | int k;
|
1875 | k++; |
1878 | k++;
|
- | 1879 | **********************/
|
|
1876 | }
|
1880 | }
|
1877 | 1881 | ||
1878 | /*
|
1882 | /*
|
1879 | 1883 | ||
1880 | QString program = tr("wmic");
|
1884 | QString program = tr("wmic");
|
Line 1941... | Line 1945... | ||
1941 | else return result; //ïîëó÷èëè íå êîððåêòíûé îòâåò |
1945 | else return result; //ïîëó÷èëè íå êîððåêòíûé îòâåò |
1942 | int m; |
1946 | int m; |
1943 | m++; |
1947 | m++; |
1944 | }
|
1948 | }
|
1945 | else { |
1949 | else { |
- | 1950 | wmiThread.terminate(); |
|
- | 1951 | /***********************
|
|
1946 | wmiThread.stop(); |
1952 | wmiThread.stop();
|
1947 | ok = wmiThread.wait(10000); |
1953 | ok = wmiThread.wait(10000);
|
1948 | int k; |
1954 | int k;
|
1949 | k++; |
1955 | k++;
|
- | 1956 | **********************/
|
|
1950 | }
|
1957 | }
|
1951 | 1958 | ||
1952 | 1959 | ||
1953 | 1960 | ||
1954 | return result; |
1961 | return result; |
Line 2003... | Line 2010... | ||
2003 | else return result; //ïîëó÷èëè íå êîððåêòíûé îòâåò |
2010 | else return result; //ïîëó÷èëè íå êîððåêòíûé îòâåò |
2004 | int m; |
2011 | int m; |
2005 | m++; |
2012 | m++; |
2006 | }
|
2013 | }
|
2007 | else { |
2014 | else { |
- | 2015 | ||
- | 2016 | wmiThread.terminate(); |
|
- | 2017 | /************************
|
|
2008 | wmiThread.stop(); |
2018 | wmiThread.stop();
|
2009 | ok = wmiThread.wait(10000); |
2019 | ok = wmiThread.wait(10000);
|
2010 | int k; |
2020 | int k;
|
2011 | k++; |
2021 | k++;
|
- | 2022 | ********************/
|
|
2012 | }
|
2023 | }
|
2013 | 2024 | ||
2014 | 2025 | ||
2015 | 2026 | ||
2016 | return result; |
2027 | return result; |
Line 2073... | Line 2084... | ||
2073 | else return result; //ïîëó÷èëè íå êîððåêòíûé îòâåò |
2084 | else return result; //ïîëó÷èëè íå êîððåêòíûé îòâåò |
2074 | int m; |
2085 | int m; |
2075 | m++; |
2086 | m++; |
2076 | }
|
2087 | }
|
2077 | else { |
2088 | else { |
- | 2089 | wmiThread.terminate(); |
|
- | 2090 | /*********************
|
|
2078 | wmiThread.stop(); |
2091 | wmiThread.stop();
|
2079 | ok = wmiThread.wait(10000); |
2092 | ok = wmiThread.wait(10000);
|
2080 | int k; |
2093 | int k;
|
2081 | k++; |
2094 | k++;
|
- | 2095 | ****************/
|
|
2082 | }
|
2096 | }
|
2083 | 2097 | ||
2084 | 2098 | ||
2085 | 2099 | ||
2086 | return result; |
2100 | return result; |
Line 2181... | Line 2195... | ||
2181 | else return result; //ïîëó÷èëè íå êîððåêòíûé îòâåò |
2195 | else return result; //ïîëó÷èëè íå êîððåêòíûé îòâåò |
2182 | int m; |
2196 | int m; |
2183 | m++; |
2197 | m++; |
2184 | }
|
2198 | }
|
2185 | else { |
2199 | else { |
- | 2200 | wmiThread.terminate(); |
|
- | 2201 | /***********************
|
|
2186 | wmiThread.stop(); |
2202 | wmiThread.stop();
|
2187 | ok = wmiThread.wait(10000); |
2203 | ok = wmiThread.wait(10000);
|
2188 | int k; |
2204 | int k;
|
2189 | k++; |
2205 | k++;
|
- | 2206 | ***************************/
|
|
2190 | }
|
2207 | }
|
2191 | 2208 | ||
2192 | 2209 | ||
2193 | 2210 | ||
2194 | 2211 | ||
Line 2258... | Line 2275... | ||
2258 | else return result; //ïîëó÷èëè íå êîððåêòíûé îòâåò |
2275 | else return result; //ïîëó÷èëè íå êîððåêòíûé îòâåò |
2259 | int m; |
2276 | int m; |
2260 | m++; |
2277 | m++; |
2261 | }
|
2278 | }
|
2262 | else { |
2279 | else { |
- | 2280 | wmiThread.terminate(); |
|
- | 2281 | /****************************
|
|
2263 | wmiThread.stop(); |
2282 | wmiThread.stop();
|
2264 | ok = wmiThread.wait(10000); |
2283 | ok = wmiThread.wait(10000);
|
2265 | int k; |
2284 | int k;
|
2266 | k++; |
2285 | k++;
|
- | 2286 | *************************/
|
|
- | 2287 | }
|
|
- | 2288 | ||
- | 2289 | ||
- | 2290 | ||
- | 2291 | ||
- | 2292 | ||
- | 2293 | }
|
|
- | 2294 | ||
- | 2295 | ||
- | 2296 | ||
- | 2297 | ||
- | 2298 | ||
- | 2299 | ||
- | 2300 | ||
- | 2301 | ||
- | 2302 | QList<TWmiCDROM> MainWindow::getWmiCDROM(QString host, QString user_name, QString password) |
|
- | 2303 | {
|
|
- | 2304 | QList<TWmiCDROM> result; |
|
- | 2305 | TWmiCDROM cdrom_tmp;
|
|
- | 2306 | bool ok; |
|
- | 2307 | QString ansver_string;
|
|
- | 2308 | ||
- | 2309 | ||
- | 2310 | wmiThread.setHost(host); // çàäàåì õîñò |
|
- | 2311 | wmiThread.setUser(user_name);//çàäàåì èìÿ ïîëüçîâàòåëÿ |
|
- | 2312 | wmiThread.setPassword( password); |
|
- | 2313 | wmiThread.setWmiString(tr("select Caption, Manufacturer from Win32_CDRomDrive")); |
|
- | 2314 | wmiThread.start(QThread::NormalPriority); |
|
- | 2315 | ok = wmiThread.wait(10000); |
|
- | 2316 | ||
- | 2317 | if (ok){ |
|
- | 2318 | QTextDocument * wmiDoc = ui->textEdit_2->document(); |
|
- | 2319 | QTextCursor * wmiCursor; |
|
- | 2320 | QStringList split_new_line; // |
|
- | 2321 | QStringList fields_list; //â ýòîì ñïèñêå ñîõðàíèì ïîëÿ |
|
- | 2322 | QStringList values_list; //à â ýòîì ñïèñêå - çíà÷åíèÿ |
|
- | 2323 | wmiCursor = new QTextCursor(wmiDoc); |
|
- | 2324 | ||
- | 2325 | ||
- | 2326 | ansver_string = wmiThread.resultString(); |
|
- | 2327 | ||
- | 2328 | ||
- | 2329 | wmiCursor->insertText(ansver_string); |
|
- | 2330 | split_new_line = ansver_string.split("\n", QString::SkipEmptyParts); // ðàçáèâàåíì îòâåò íà ñòðîêè |
|
- | 2331 | if(split_new_line.count()>2) { |
|
- | 2332 | QString tmp_str;
|
|
- | 2333 | tmp_str = split_new_line.at(1); |
|
- | 2334 | fields_list = tmp_str.split("|"); |
|
- | 2335 | ||
- | 2336 | for(int i=2; i< split_new_line.count(); i++) |
|
- | 2337 | {
|
|
- | 2338 | cdrom_tmp.name = ""; |
|
- | 2339 | cdrom_tmp.manufacturer = ""; |
|
- | 2340 | tmp_str = split_new_line.at(i); |
|
- | 2341 | values_list = tmp_str.split("|"); |
|
- | 2342 | int index_tmp; |
|
- | 2343 | index_tmp = fields_list.indexOf(tr("Caption")); // íàèìåíîâàíèå ïðèíòåðà |
|
- | 2344 | if ((index_tmp!=-1) && (index_tmp < values_list.count())) cdrom_tmp.name = values_list.at(index_tmp); |
|
- | 2345 | index_tmp = fields_list.indexOf(tr("Manufacturer")); // ïðîèçâîäèòåëü äèñêà |
|
- | 2346 | if ((index_tmp!=-1) && (index_tmp < values_list.count())) cdrom_tmp.manufacturer = values_list.at(index_tmp); |
|
- | 2347 | ||
- | 2348 | result << cdrom_tmp; |
|
- | 2349 | ||
- | 2350 | }; |
|
- | 2351 | ||
- | 2352 | return result; |
|
2267 | }
|
2353 | }
|
- | 2354 | else return result; //ïîëó÷èëè íå êîððåêòíûé îòâåò |
|
- | 2355 | int m; |
|
- | 2356 | m++; |
|
- | 2357 | }
|
|
- | 2358 | else { |
|
- | 2359 | wmiThread.terminate(); |
|
- | 2360 | return result; |
|
- | 2361 | /*********
|
|
- | 2362 | wmiThread.stop();
|
|
- | 2363 | ok = wmiThread.wait(10000);
|
|
- | 2364 | int k;
|
|
- | 2365 | k++;
|
|
- | 2366 | *******/
|
|
- | 2367 | }
|
|
- | 2368 | ||
- | 2369 | ||
- | 2370 | ||
- | 2371 | ||
- | 2372 | ||
- | 2373 | }
|
|
- | 2374 | ||
- | 2375 | ||
- | 2376 | ||
- | 2377 | QList<TWmiNetCard> MainWindow::getWmiNetCard(QString host, QString user_name, QString password){ |
|
- | 2378 | ||
- | 2379 | QList<TWmiNetCard> result; |
|
- | 2380 | TWmiNetCard netCard_tmp;
|
|
- | 2381 | bool ok; |
|
- | 2382 | QString ansver_string;
|
|
- | 2383 | wmiThread.setHost(host); // çàäàåì õîñò |
|
- | 2384 | wmiThread.setUser(user_name);//çàäàåì èìÿ ïîëüçîâàòåëÿ |
|
- | 2385 | wmiThread.setPassword( password); |
|
- | 2386 | wmiThread.setWmiString(tr("Select Description, Caption, MACAddress from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")); |
|
- | 2387 | wmiThread.start(QThread::NormalPriority); |
|
- | 2388 | ok = wmiThread.wait(10000); |
|
- | 2389 | ||
- | 2390 | ||
- | 2391 | ||
- | 2392 | if (ok){ |
|
- | 2393 | QTextDocument * wmiDoc = ui->textEdit_2->document(); |
|
- | 2394 | QTextCursor * wmiCursor; |
|
- | 2395 | QStringList split_new_line; // |
|
- | 2396 | QStringList fields_list; //â ýòîì ñïèñêå ñîõðàíèì ïîëÿ |
|
- | 2397 | QStringList values_list; //à â ýòîì ñïèñêå - çíà÷åíèÿ |
|
- | 2398 | wmiCursor = new QTextCursor(wmiDoc); |
|
- | 2399 | ||
- | 2400 | ||
- | 2401 | ansver_string = wmiThread.resultString(); |
|
- | 2402 | ||
- | 2403 | ||
- | 2404 | wmiCursor->insertText(ansver_string); |
|
- | 2405 | split_new_line = ansver_string.split("\n", QString::SkipEmptyParts); // ðàçáèâàåíì îòâåò íà ñòðîêè |
|
- | 2406 | if(split_new_line.count()>2) { |
|
- | 2407 | QString tmp_str;
|
|
- | 2408 | tmp_str = split_new_line.at(1); |
|
- | 2409 | fields_list = tmp_str.split("|"); |
|
- | 2410 | ||
- | 2411 | for(int i=2; i< split_new_line.count(); i++) |
|
- | 2412 | {
|
|
- | 2413 | netCard_tmp.caption = ""; |
|
- | 2414 | netCard_tmp.MACAddress= ""; |
|
- | 2415 | tmp_str = split_new_line.at(i); |
|
- | 2416 | values_list = tmp_str.split("|"); |
|
- | 2417 | int index_tmp; |
|
- | 2418 | index_tmp = fields_list.indexOf(tr("Description")); // íàèìåíîâàíèå ïðèíòåðà |
|
- | 2419 | if ((index_tmp!=-1) && (index_tmp < values_list.count())) netCard_tmp.caption = values_list.at(index_tmp); |
|
- | 2420 | index_tmp = fields_list.indexOf(tr("MACAddress")); // ïðîèçâîäèòåëü äèñêà |
|
- | 2421 | if ((index_tmp!=-1) && (index_tmp < values_list.count())) netCard_tmp.MACAddress = values_list.at(index_tmp); |
|
- | 2422 | ||
- | 2423 | result << netCard_tmp; |
|
- | 2424 | ||
- | 2425 | }; |
|
- | 2426 | ||
- | 2427 | return result; |
|
- | 2428 | }
|
|
- | 2429 | else return result; //ïîëó÷èëè íå êîððåêòíûé îòâåò |
|
- | 2430 | int m; |
|
- | 2431 | m++; |
|
- | 2432 | }
|
|
- | 2433 | else { |
|
- | 2434 | wmiThread.terminate(); |
|
- | 2435 | return result; |
|
- | 2436 | /*********
|
|
- | 2437 | wmiThread.stop();
|
|
- | 2438 | ok = wmiThread.wait(10000);
|
|
- | 2439 | int k;
|
|
- | 2440 | k++;
|
|
- | 2441 | *******/
|
|
- | 2442 | }
|
|
- | 2443 | ||
- | 2444 | ||
- | 2445 | ||
- | 2446 | ||
- | 2447 | ||
2268 | 2448 | ||
2269 | 2449 | ||
2270 | 2450 | ||
2271 | 2451 | ||
2272 | 2452 |