Subversion Repositories OpenInventory

Rev

Rev 240 | Rev 242 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
240 pingvin 1
#include "wmithread.h"
2
 
3
WmiThread::WmiThread(QObject *parent) :
4
    QThread(parent)
5
{
241 pingvin 6
    connect(&process, SIGNAL(readyReadStandardOutput()), this, SLOT(readStandartProcessOutput()));
7
    connect(&process, SIGNAL(readyReadStandardError()), this, SLOT(readStandartProcessError()));
8
    mutex.lock();
9
    stopped = false;
10
    mutex.unlock();
240 pingvin 11
 
12
 
13
 
14
}
15
 
16
void WmiThread::run(){
17
 
241 pingvin 18
 
19
 
20
    QString query_string;
21
    error = false; //  
22
    query_string = tr("wmic -U ");
23
    query_string.append(user_name);
24
    query_string.append(tr("%"));
25
    query_string.append(password);
26
    query_string.append(tr(" //"));
27
    query_string.append(host);
28
    query_string.append(tr(" \""));
29
    query_string.append(wmi_string);
30
    query_string.append(tr("\""));
31
    process.start(query_string);
32
 
33
    while (!stopped);
34
  //  exec();
240 pingvin 35
}
36
 
37
void WmiThread::stop(){
38
      mutex.lock();
39
      stopped = true;
40
      mutex.unlock();
41
}
42
 
43
void WmiThread::readStandartProcessOutput(){
44
p_buffer = process.readAllStandardOutput();
241 pingvin 45
mutex.lock();
46
stopped = true;
47
mutex.unlock();
240 pingvin 48
}
49
 
50
void WmiThread::readStandartProcessError(){
51
p_buffer = process.readAllStandardError();
241 pingvin 52
error = true; //  ,     WMI-
240 pingvin 53
}