1.1 --- a/OpenSecurity/bin/cygwin.py Wed Feb 19 12:59:29 2014 +0100
1.2 +++ b/OpenSecurity/bin/cygwin.py Fri Feb 21 11:04:04 2014 +0100
1.3 @@ -38,7 +38,7 @@
1.4 import sys
1.5 import _winreg
1.6 from subprocess import Popen, PIPE, call, STARTUPINFO, _subprocess
1.7 -
1.8 +import threading
1.9 # local
1.10 from environment import Environment
1.11 from opensecurity_util import logger, setupLogger, OpenSecurityException
1.12 @@ -119,30 +119,34 @@
1.13 def cmd():
1.14 return Cygwin.win_cmd
1.15
1.16 + executeLock = threading.Lock()
1.17 #executes command on host system
1.18 @staticmethod
1.19 def execute(program, arguments, wait_return=True, window = False):
1.20 - _startupinfo = STARTUPINFO()
1.21 - if not window:
1.22 - _startupinfo.dwFlags |= _subprocess.STARTF_USESHOWWINDOW
1.23 - _startupinfo.wShowWindow = _subprocess.SW_HIDE
1.24 -
1.25 - logger.debug('trying to launch: ' + program + ' ' + ''.join(arguments))
1.26 - try:
1.27 - process = Popen(executable=program, args=' ' + arguments, startupinfo = _startupinfo, stdin=PIPE, stdout=PIPE, stderr=PIPE, shell = False)
1.28 - logger.debug('Launched: ' + program + ' ' + ''.join(arguments))
1.29 - if not wait_return:
1.30 - return [0, 'working in background', '']
1.31 - result = process.wait()
1.32 - res_stdout = process.stdout.read();
1.33 - res_stderr = process.stderr.read();
1.34 - if res_stdout != "":
1.35 - logger.debug(res_stdout)
1.36 - if res_stderr != "":
1.37 - logger.debug(res_stderr)
1.38 - except:
1.39 - logger.error('Failed to execute cygwin command.\n\tcommand=' + program + ' ' + ''.join(arguments) + '\n')
1.40 - #TODO: throw exception
1.41 + if Cygwin.executeLock.acquire(True):
1.42 + _startupinfo = STARTUPINFO()
1.43 + if not window:
1.44 + _startupinfo.dwFlags |= _subprocess.STARTF_USESHOWWINDOW
1.45 + _startupinfo.wShowWindow = _subprocess.SW_HIDE
1.46 +
1.47 + #logger.debug('trying to launch: ' + program + ' ' + ''.join(arguments))
1.48 + try:
1.49 + process = Popen(executable=program, args=' ' + arguments, startupinfo = _startupinfo, stdin=PIPE, stdout=PIPE, stderr=PIPE, shell = False)
1.50 + logger.debug('Launched: ' + program + ' ' + ''.join(arguments))
1.51 + if not wait_return:
1.52 + return [0, 'working in background', '']
1.53 + result = process.wait()
1.54 + res_stdout = process.stdout.read();
1.55 + res_stderr = process.stderr.read();
1.56 + #if res_stdout != "":
1.57 + # logger.debug(res_stdout)
1.58 + #if res_stderr != "":
1.59 + # logger.debug(res_stderr)
1.60 + except:
1.61 + logger.error('Failed to execute cygwin command.\n\tcommand=' + program + ' ' + ''.join(arguments) + '\n')
1.62 + #TODO: throw exception
1.63 +
1.64 + Cygwin.executeLock.release()
1.65 return result, res_stdout, res_stderr
1.66
1.67 @staticmethod
2.1 --- a/OpenSecurity/bin/opensecurity_util.py Wed Feb 19 12:59:29 2014 +0100
2.2 +++ b/OpenSecurity/bin/opensecurity_util.py Fri Feb 21 11:04:04 2014 +0100
2.3 @@ -8,6 +8,27 @@
2.4 # local
2.5 from environment import Environment
2.6
2.7 +class DictDiffer(object):
2.8 + """
2.9 + Calculate the difference between two dictionaries as:
2.10 + (1) items added
2.11 + (2) items removed
2.12 + (3) keys same in both but changed values
2.13 + (4) keys same in both and unchanged values
2.14 + """
2.15 + def __init__(self, current_dict, past_dict):
2.16 + self.current_dict, self.past_dict = current_dict, past_dict
2.17 + self.set_current, self.set_past = set(current_dict.keys()), set(past_dict.keys())
2.18 + self.intersect = self.set_current.intersection(self.set_past)
2.19 + def added(self):
2.20 + return self.set_current - self.intersect
2.21 + def removed(self):
2.22 + return self.set_past - self.intersect
2.23 + def changed(self):
2.24 + return set(o for o in self.intersect if self.past_dict[o] != self.current_dict[o])
2.25 + def unchanged(self):
2.26 + return set(o for o in self.intersect if self.past_dict[o] == self.current_dict[o])
2.27 +
2.28 class OpenSecurityException(Exception):
2.29 def __init__(self, value):
2.30 self.value = value
3.1 --- a/OpenSecurity/bin/vmmanager.pyw Wed Feb 19 12:59:29 2014 +0100
3.2 +++ b/OpenSecurity/bin/vmmanager.pyw Fri Feb 21 11:04:04 2014 +0100
3.3 @@ -55,11 +55,15 @@
3.4 startNotifications = list()
3.5 _instance = None
3.6 machineFolder = ''
3.7 + attachedRSDs = None
3.8 + connectedRSDs = None
3.9
3.10 def __init__(self):
3.11 self.systemProperties = self.getSystemProperties()
3.12 self.machineFolder = self.systemProperties["Default machine folder"]
3.13 self.cleanup()
3.14 + self.attachedRSDs = self.getAttachedRSDs()
3.15 + self.connectedRSDs = self.getConnectedRSDS()
3.16 return
3.17
3.18 @staticmethod
3.19 @@ -87,7 +91,7 @@
3.20 if result[1]=='':
3.21 return None
3.22 props = dict((k.strip(),v.strip().strip('"')) for k,v in (line.split(':', 1) for line in result[1].strip().splitlines()))
3.23 - logger.debug(props)
3.24 + #logger.debug(props)
3.25 return props
3.26
3.27 # return the folder containing the guest VMs
3.28 @@ -101,27 +105,6 @@
3.29 return None
3.30 props = dict((k.strip(),v.strip().strip('"')) for k,v in (line.split(':', 1) for line in result.strip().splitlines()))
3.31 return props
3.32 -
3.33 - def listRSDS(self):
3.34 - results = Cygwin.vboxExecute('list usbhost')[1]
3.35 - results = results.split('Host USB Devices:')[1].strip()
3.36 -
3.37 - items = list( "UUID:"+result for result in results.split('UUID:') if result != '')
3.38 - rsds = dict()
3.39 - for item in items:
3.40 - props = dict()
3.41 - for line in item.splitlines():
3.42 - if line != "":
3.43 - k,v = line[:line.index(':')].strip(), line[line.index(':')+1:].strip()
3.44 - props[k] = v
3.45 -
3.46 - if 'Product' in props.keys() and props['Product'] == 'Mass Storage':
3.47 - usb_filter = USBFilter( re.search(r"\((?P<vid>[0-9A-Fa-f]+)\)", props['VendorId']).groupdict()['vid'],
3.48 - re.search(r"\((?P<pid>[0-9A-Fa-f]+)\)", props['ProductId']).groupdict()['pid'],
3.49 - re.search(r"\((?P<rev>[0-9A-Fa-f]+)\)", props['Revision']).groupdict()['rev'] )
3.50 - rsds[props['UUID']] = usb_filter;
3.51 - logger.debug(usb_filter)
3.52 - return rsds
3.53
3.54 # list all existing VMs registered with VBox
3.55 def listVM(self):
3.56 @@ -152,6 +135,28 @@
3.57 return self.vmRootName+str(i)
3.58 return ''
3.59
3.60 + # return the RSDs connected to the host
3.61 + def getConnectedRSDS(self):
3.62 + results = Cygwin.vboxExecute('list usbhost')[1]
3.63 + results = results.split('Host USB Devices:')[1].strip()
3.64 +
3.65 + items = list( "UUID:"+result for result in results.split('UUID:') if result != '')
3.66 + rsds = dict()
3.67 + for item in items:
3.68 + props = dict()
3.69 + for line in item.splitlines():
3.70 + if line != "":
3.71 + k,v = line[:line.index(':')].strip(), line[line.index(':')+1:].strip()
3.72 + props[k] = v
3.73 +
3.74 + if 'Product' in props.keys() and props['Product'] == 'Mass Storage':
3.75 + usb_filter = USBFilter( re.search(r"\((?P<vid>[0-9A-Fa-f]+)\)", props['VendorId']).groupdict()['vid'],
3.76 + re.search(r"\((?P<pid>[0-9A-Fa-f]+)\)", props['ProductId']).groupdict()['pid'],
3.77 + re.search(r"\((?P<rev>[0-9A-Fa-f]+)\)", props['Revision']).groupdict()['rev'] )
3.78 + rsds[props['UUID']] = usb_filter;
3.79 + logger.debug(usb_filter)
3.80 + return rsds
3.81 +
3.82 # return the RSDs attached to all existing SDVMs
3.83 def getAttachedRSDs(self):
3.84 vms = self.listSDVM()
3.85 @@ -207,6 +212,7 @@
3.86
3.87 # list storage snaphots for VM
3.88 def updateTemplate(self):
3.89 + self.cleanup()
3.90 self.poweroffVM('SecurityDVM')
3.91 self.waitShutdown('SecurityDVM')
3.92
3.93 @@ -250,13 +256,15 @@
3.94 self.storageAttach('SecurityDVM')
3.95 self.startVM('SecurityDVM')
3.96 self.waitStartup('SecurityDVM')
3.97 - Cygwin.sshExecute('sudo apt-get -y update', VMManager.getHostOnlyIP('SecurityDVM'), 'osecuser', Cygwin.cygPath(self.machineFolder) + '/' + 'SecurityDVM' + '/dvm_key' )
3.98 - Cygwin.sshExecute('sudo apt-get -y upgrade', VMManager.getHostOnlyIP('SecurityDVM'), 'osecuser', Cygwin.cygPath(self.machineFolder) + '/' + 'SecurityDVM' + '/dvm_key' )
3.99 + Cygwin.sshExecute('"sudo apt-get -y update"', VMManager.getHostOnlyIP('SecurityDVM'), 'osecuser', Cygwin.cygPath(self.machineFolder) + '/' + 'SecurityDVM' + '/dvm_key' )
3.100 + Cygwin.sshExecute('"sudo apt-get -y upgrade"', VMManager.getHostOnlyIP('SecurityDVM'), 'osecuser', Cygwin.cygPath(self.machineFolder) + '/' + 'SecurityDVM' + '/dvm_key' )
3.101 self.stopVM('SecurityDVM')
3.102 + #self.hibernateVM('SecurityDVM')
3.103 self.waitShutdown('SecurityDVM')
3.104 self.storageDetach('SecurityDVM')
3.105 self.changeStorageType(template_storage,'immutable')
3.106 self.storageAttach('SecurityDVM')
3.107 + self.handleDeviceChange()
3.108
3.109 #remove VM from the system. should be used on VMs returned by listSDVMs
3.110 def removeVM(self, vm_name):
3.111 @@ -282,7 +290,12 @@
3.112 # stop VM
3.113 def stopVM(self, vm_name):
3.114 logger.info('Sending shutdown signal to ' + vm_name)
3.115 - Cygwin.sshExecute( 'sudo shutdown -h now', VMManager.getHostOnlyIP(vm_name), 'osecuser', Cygwin.cygPath(self.machineFolder) + '/' + vm_name + '/dvm_key' )
3.116 + Cygwin.sshExecute( '"sudo shutdown -h now"', VMManager.getHostOnlyIP(vm_name), 'osecuser', Cygwin.cygPath(self.machineFolder) + '/' + vm_name + '/dvm_key' )
3.117 +
3.118 + # stop VM
3.119 + def hibernateVM(self, vm_name):
3.120 + logger.info('Sending shutdown signal to ' + vm_name)
3.121 + Cygwin.sshExecute( '"sudo hibernate-disk"', VMManager.getHostOnlyIP(vm_name), 'osecuser', Cygwin.cygPath(self.machineFolder) + '/' + vm_name + '/dvm_key' )
3.122
3.123 # poweroff VM
3.124 def poweroffVM(self, vm_name):
3.125 @@ -316,7 +329,7 @@
3.126 def getVMInfo(self, vm_name):
3.127 results = Cygwin.vboxExecute('showvminfo ' + vm_name + ' --machinereadable')[1]
3.128 props = dict((k.strip().strip('"'),v.strip().strip('"')) for k,v in (line.split('=', 1) for line in results.splitlines()))
3.129 - logger.debug(props)
3.130 + #logger.debug(props)
3.131 return props
3.132
3.133 # return the configured USB filter for an existing VM
3.134 @@ -357,33 +370,56 @@
3.135 result = Cygwin.vboxExecute('storageattach ' + vm_name + ' --storagectl SATA --port 1 --device 0 --type dvddrive --mtype readonly --medium \"' + self.machineFolder + '\\' + vm_name + '\\'+ vm_name + '.iso\"')
3.136 return result
3.137
3.138 +
3.139 handleDeviceChangeLock = threading.Lock()
3.140 -
3.141 + trigger = False
3.142 # handles device change events
3.143 def handleDeviceChange(self):
3.144 if VMManager.handleDeviceChangeLock.acquire(True):
3.145 + #logger.debug("triggered")
3.146 + #VMManager.handleDeviceChangeLock.release()
3.147 + #return
3.148 #destroy unused vms
3.149 - new_ip = None
3.150 - attached_devices = self.getAttachedRSDs()
3.151 - connected_devices = self.listRSDS()
3.152 - for vm_name in attached_devices.keys():
3.153 - if attached_devices[vm_name] not in connected_devices.values():
3.154 + #diff = DictDiffer(self.connectedRSDs, tmp_conn)
3.155 + retry = 0
3.156 + while retry < 30:
3.157 + if self.getConnectedRSDS().keys() == self.connectedRSDs.keys():
3.158 + logger.info("Nothing's changed. Waiting for VBox USB sub-system to update...")
3.159 + else:
3.160 + self.connectedRSDs = self.getConnectedRSDS()
3.161 + break
3.162 + time.sleep(1)
3.163 + retry+=1
3.164 +
3.165 + if retry == 30:
3.166 + VMManager.handleDeviceChangeLock.release()
3.167 + return None
3.168 +
3.169 + logger.info("Something's changed")
3.170 +
3.171 + self.attachedRSDs = self.getAttachedRSDs()
3.172 +
3.173 + for vm_name in self.attachedRSDs.keys():
3.174 + if self.attachedRSDs[vm_name] not in self.connectedRSDs.values():
3.175 self.unmapNetworkDrive('h:')
3.176 #self.stopVM(vm_name)
3.177 self.detachRSD(vm_name)
3.178 self.poweroffVM(vm_name)
3.179 self.removeVM(vm_name)
3.180 #create new vm for attached device if any
3.181 - attached_devices = self.getAttachedRSDs()
3.182 - connected_devices = self.listRSDS()
3.183 - for connected_device in connected_devices.values():
3.184 - if (attached_devices and False) or (connected_device not in attached_devices.values()):
3.185 + self.attachedRSDs = self.getAttachedRSDs()
3.186 + self.connectedRSDs = self.getConnectedRSDS()
3.187 +
3.188 + new_ip = None
3.189 + for connected_device in self.connectedRSDs.values():
3.190 + if (self.attachedRSDs and False) or (connected_device not in self.attachedRSDs.values()):
3.191 new_sdvm = self.generateSDVMName()
3.192 self.createVM(new_sdvm)
3.193 self.storageAttach(new_sdvm)
3.194 self.attachRSD(new_sdvm, connected_device)
3.195 self.startVM(new_sdvm)
3.196 new_ip = self.waitStartup(new_sdvm)
3.197 +
3.198 if new_ip != None:
3.199 self.mapNetworkDrive('h:', '\\\\' + new_ip + '\\USB', None, None)
3.200 #TODO: cleanup notifications somwhere else (eg. machine shutdown)
3.201 @@ -425,9 +461,10 @@
3.202 return new_sdvm
3.203
3.204 #Small function to check the availability of network resource.
3.205 - def isAvailable(self, path):
3.206 - result = Cygwin.cmdExecute('IF EXIST "' + path + '" echo YES')
3.207 - return string.find(result[1], 'YES',)
3.208 + #def isAvailable(self, path):
3.209 + #return os.path.exists(path)
3.210 + #result = Cygwin.cmdExecute('IF EXIST "' + path + '" echo YES')
3.211 + #return string.find(result[1], 'YES',)
3.212
3.213 #Small function to check if the mention location is a directory
3.214 def isDirectory(self, path):
3.215 @@ -437,11 +474,11 @@
3.216 def mapNetworkDrive(self, drive, networkPath, user, password):
3.217 self.unmapNetworkDrive(drive)
3.218 #Check for drive availability
3.219 - if self.isAvailable(drive) > -1:
3.220 + if os.path.exists(drive):
3.221 logger.error("Drive letter is already in use: " + drive)
3.222 return -1
3.223 #Check for network resource availability
3.224 - while self.isAvailable(networkPath) == -1:
3.225 + while not os.path.exists(networkPath):
3.226 time.sleep(1)
3.227 logger.info("Path not accessible: " + networkPath + " retrying")
3.228 #return -1
3.229 @@ -458,18 +495,34 @@
3.230 return 1
3.231
3.232 def unmapNetworkDrive(self, drive):
3.233 - if self.isAvailable(drive) == -1:
3.234 + if not os.path.exists(drive):
3.235 return -1
3.236 result = Cygwin.execute('C:\\Windows\\system32\\net.exe', 'USE ' + drive + ' /DELETE /YES')
3.237 if string.find(str(result), 'successfully',) == -1:
3.238 + logger.error(result[2])
3.239 return -1
3.240 return 1
3.241
3.242 +class DeviceHandler(threading.Thread):
3.243 + vmm = None
3.244 + triggered = False
3.245 + def __init__(self, zahl):
3.246 + threading.Thread.__init__(self)
3.247 + self.vmm = None
3.248 +
3.249 + def run(self):
3.250 + while True:
3.251 + if self.triggered:
3.252 + logger.debug("triggered")
3.253 + triggered = False
3.254 + else:
3.255 + time.sleep(1)
3.256 +
3.257
3.258 if __name__ == '__main__':
3.259 man = VMManager.getInstance()
3.260 #man.listVM()
3.261 - print man.listRSDS()
3.262 + print man.getConnectedRSDs()
3.263
3.264 #man.listVM()
3.265 #man.listVM()
4.1 Binary file server/windows/USBEventSvc/Debug/OpenSecUSBEventSvc.exe has changed
5.1 Binary file server/windows/USBEventSvc/Debug/OpenSecUSBEventSvc.ilk has changed
6.1 Binary file server/windows/USBEventSvc/Debug/OpenSecUSBEventSvc.pdb has changed
7.1 Binary file server/windows/USBEventSvc/Debug/OpenSecUSBEventSvcLog.dll has changed
8.1 --- a/server/windows/USBEventSvc/OpenSecUSBEventSvc/OpenSecUSBEventSvc.cpp Wed Feb 19 12:59:29 2014 +0100
8.2 +++ b/server/windows/USBEventSvc/OpenSecUSBEventSvc/OpenSecUSBEventSvc.cpp Fri Feb 21 11:04:04 2014 +0100
8.3 @@ -8,6 +8,7 @@
8.4 #include <usbiodef.h>
8.5 #include <Winhttp.h>
8.6 #include "OpenSecUSBEventSvcLog.h"
8.7 +#include <devguid.h>
8.8
8.9 #pragma comment(lib, "advapi32.lib")
8.10
8.11 @@ -16,18 +17,6 @@
8.12 //sc create "USBEventSvc" binPath= "C:\Users\BarthaM\Documents\Visual Studio 2010\Projects\USBEventSvc\Debug\USBEventSvc.exe"
8.13 //sc delete "USBEventSvc"
8.14
8.15 -// USB Raw Device Interface Class GUID
8.16 -//{ 0xa5dcbf10, 0x6530, 0x11d2, { 0x90, 0x1f, 0x00, 0xc0, 0x4f, 0xb9, 0x51,0xed } }
8.17 -// Disk Device Interface Class GUID
8.18 -//{ 0x53f56307, 0xb6bf, 0x11d0, { 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b } }
8.19 -
8.20 -// This GUID is for all USB serial host PnP drivers
8.21 -//GUID WceusbshGUID = { 0x25dbce51, 0x6c8f, 0x4a72, 0x8a, 0x6d, 0xb5, 0x4c, 0x2b, 0x4f, 0xc8, 0x35 };
8.22 -
8.23 -GUID WceusbshGUID = { 0x88bae032, 0x5a81, 0x49f0, 0xbc, 0x3d, 0xa4, 0xff, 0x13, 0x82, 0x16, 0xd6 };
8.24 -//DEFINE_GUID(GUID_CLASS_STORAGE_VOLUME, 0x53F5630DL, 0xB6BF, 0x11D0, 0x94, 0xF2, 0x00, 0xA0, 0xC9, 0x1E, 0xFB, 0x8B);
8.25 -
8.26 -
8.27 SERVICE_STATUS gSvcStatus;
8.28 SERVICE_STATUS_HANDLE gSvcStatusHandle = NULL;
8.29 HANDLE ghSvcStopEvent = NULL;
8.30 @@ -62,17 +51,24 @@
8.31 // could be made from this template.
8.32
8.33 BOOL DoRegisterDeviceInterfaceToHwnd(void) {
8.34 - DEV_BROADCAST_DEVICEINTERFACE NotificationFilter;
8.35 - ZeroMemory(&NotificationFilter, sizeof (NotificationFilter));
8.36 - NotificationFilter.dbcc_size = sizeof (DEV_BROADCAST_DEVICEINTERFACE);
8.37 - NotificationFilter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
8.38 - NotificationFilter.dbcc_classguid = GUID_DEVINTERFACE_USB_DEVICE;
8.39 - memcpy(&(NotificationFilter.dbcc_classguid), &(GUID_DEVINTERFACE_USB_DEVICE), sizeof(struct _GUID));
8.40 + DEV_BROADCAST_DEVICEINTERFACE notificationFilter;
8.41 + ZeroMemory(¬ificationFilter, sizeof (notificationFilter));
8.42 + notificationFilter.dbcc_size = sizeof (DEV_BROADCAST_DEVICEINTERFACE);
8.43 + notificationFilter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
8.44 + notificationFilter.dbcc_reserved = 0;
8.45 + notificationFilter.dbcc_classguid =
8.46 + //GUID_DEVINTERFACE_USB_DEVICE;
8.47 + //{ 0x25dbce51, 0x6c8f, 0x4a72, 0x8a, 0x6d, 0xb5, 0x4c, 0x2b, 0x4f, 0xc8, 0x35 }; // This GUID is for all USB serial host PnP drivers
8.48 + //{ 0x53f56307, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b }; // Disk Device Interface Class GUID
8.49 + //{ 0xa5dcbf10, 0x6530, 0x11d2, 0x90, 0x1f, 0x00, 0xc0, 0x4f, 0xb9, 0x51, 0xed }; // USB Raw Device Interface Class GUID
8.50 + //{ 0x88bae032, 0x5a81, 0x49f0, 0xbc, 0x3d, 0xa4, 0xff, 0x13, 0x82, 0x16, 0xd6 };
8.51 + GUID_DEVCLASS_USB;
8.52 +
8.53 + //memcpy(&(notificationFilter.dbcc_classguid), &(GUID_DEVINTERFACE_USB_DEVICE), sizeof(struct _GUID));
8.54
8.55 - ghDeviceNotify = RegisterDeviceNotification(gSvcStatusHandle,
8.56 - &NotificationFilter,
8.57 - DEVICE_NOTIFY_SERVICE_HANDLE);// | DEVICE_NOTIFY_ALL_INTERFACE_CLASSES);
8.58 -
8.59 + ghDeviceNotify = RegisterDeviceNotification( gSvcStatusHandle,
8.60 + ¬ificationFilter,
8.61 + DEVICE_NOTIFY_SERVICE_HANDLE /*| DEVICE_NOTIFY_ALL_INTERFACE_CLASSES*/);
8.62 if (NULL == ghDeviceNotify) {
8.63 SvcReportEvent(EVENTLOG_ERROR_TYPE, _T("RegisterDeviceNotification failed!"));
8.64 return FALSE;
8.65 @@ -212,7 +208,6 @@
8.66 // Wait until our worker thread exits signaling that the service needs to stop
8.67 WaitForSingleObject(ghSvcStopEvent, INFINITE);
8.68
8.69 - SvcReportEvent(EVENTLOG_INFORMATION_TYPE, TEXT("OpenSecUSBEventSvc is exiting"));
8.70 // Perform any cleanup tasks
8.71 CloseHandle(ghSvcStopEvent);
8.72
8.73 @@ -335,8 +330,8 @@
8.74 break;
8.75
8.76 case SERVICE_CONTROL_DEVICEEVENT:
8.77 - SvcReportEvent(EVENTLOG_INFORMATION_TYPE, _T("Received SERVICE_CONTROL_DEVICEEVENT"));
8.78 - NotifyOpenSecManager();
8.79 + SvcReportEvent(EVENTLOG_INFORMATION_TYPE, TEXT("Received SERVICE_CONTROL_DEVICEEVENT"));
8.80 + //NotifyOpenSecManager();
8.81 break;
8.82
8.83 default:
8.84 @@ -365,34 +360,20 @@
8.85 hEventSource = RegisterEventSource(NULL, SVCNAME);
8.86
8.87 if (NULL != hEventSource) {
8.88 - if (type == EVENTLOG_ERROR_TYPE)
8.89 - StringCchPrintf(Buffer, 80, TEXT("Error has occured. %s failed with %d"), szFunction, GetLastError());
8.90 - else
8.91 - StringCchPrintf(Buffer, 80, TEXT("%s"), szFunction);
8.92 + StringCchPrintf(Buffer, 80, TEXT("%s failed with %d"), szFunction, GetLastError());
8.93
8.94 lpszStrings[0] = SVCNAME;
8.95 lpszStrings[1] = Buffer;
8.96
8.97 - if (type == EVENTLOG_ERROR_TYPE)
8.98 - ReportEvent(hEventSource,
8.99 - type, // event type
8.100 - 0, // event category
8.101 - SVC_ERROR, // event identifier
8.102 - NULL, // no security identifier
8.103 - 2, // size of lpszStrings array
8.104 - 0, // no binary data
8.105 - lpszStrings, // array of strings
8.106 - NULL); // no binary data
8.107 - else
8.108 - ReportEvent(hEventSource,
8.109 - type, // event type
8.110 - 0, // event category
8.111 - SVC_ERROR, // event identifier
8.112 - NULL, // no security identifier
8.113 - 2, // size of lpszStrings array
8.114 - 0, // no binary data
8.115 - lpszStrings, // array of strings
8.116 - NULL); // no binary data
8.117 + ReportEvent(hEventSource, // event log handle
8.118 + type, // event type
8.119 + 0, // event category
8.120 + SVC_ERROR, // event identifier
8.121 + NULL, // no security identifier
8.122 + 2, // size of lpszStrings array
8.123 + 0, // no binary data
8.124 + lpszStrings, // array of strings
8.125 + NULL); // no binary data
8.126
8.127 DeregisterEventSource(hEventSource);
8.128 }
9.1 --- a/server/windows/USBEventSvc/OpenSecUSBEventSvc/OpenSecUSBEventSvc.vcxproj Wed Feb 19 12:59:29 2014 +0100
9.2 +++ b/server/windows/USBEventSvc/OpenSecUSBEventSvc/OpenSecUSBEventSvc.vcxproj Fri Feb 21 11:04:04 2014 +0100
9.3 @@ -68,12 +68,14 @@
9.4 <PropertyGroup Label="UserMacros" />
9.5 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
9.6 <LinkIncremental>true</LinkIncremental>
9.7 + <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
9.8 </PropertyGroup>
9.9 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
9.10 <LinkIncremental>true</LinkIncremental>
9.11 </PropertyGroup>
9.12 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
9.13 <LinkIncremental>false</LinkIncremental>
9.14 + <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
9.15 </PropertyGroup>
9.16 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
9.17 <LinkIncremental>false</LinkIncremental>
10.1 --- a/server/windows/USBEventSvc/OpenSecUSBEventSvcLog/OpenSecUSBEventSvcLog.vcxproj Wed Feb 19 12:59:29 2014 +0100
10.2 +++ b/server/windows/USBEventSvc/OpenSecUSBEventSvcLog/OpenSecUSBEventSvcLog.vcxproj Fri Feb 21 11:04:04 2014 +0100
10.3 @@ -69,12 +69,14 @@
10.4 <PropertyGroup Label="UserMacros" />
10.5 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
10.6 <LinkIncremental>true</LinkIncremental>
10.7 + <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
10.8 </PropertyGroup>
10.9 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
10.10 <LinkIncremental>true</LinkIncremental>
10.11 </PropertyGroup>
10.12 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
10.13 <LinkIncremental>false</LinkIncremental>
10.14 + <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
10.15 </PropertyGroup>
10.16 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
10.17 <LinkIncremental>false</LinkIncremental>
11.1 Binary file server/windows/USBEventSvc/Release/OpenSecUSBEventSvc.exe has changed
12.1 Binary file server/windows/USBEventSvc/Release/OpenSecUSBEventSvc.pdb has changed
13.1 Binary file server/windows/USBEventSvc/Release/OpenSecUSBEventSvcLog.dll has changed
14.1 Binary file server/windows/USBEventSvc/USBEventSvc.sdf has changed
15.1 --- a/server/windows/USBEventSvc/USBEventSvc.sln Wed Feb 19 12:59:29 2014 +0100
15.2 +++ b/server/windows/USBEventSvc/USBEventSvc.sln Fri Feb 21 11:04:04 2014 +0100
15.3 @@ -26,9 +26,11 @@
15.4 {B54F4A89-7357-4879-AE62-0825AD3E5974}.Debug|Win32.ActiveCfg = Debug|Win32
15.5 {B54F4A89-7357-4879-AE62-0825AD3E5974}.Debug|Win32.Build.0 = Debug|Win32
15.6 {B54F4A89-7357-4879-AE62-0825AD3E5974}.Debug|x64.ActiveCfg = Debug|x64
15.7 + {B54F4A89-7357-4879-AE62-0825AD3E5974}.Debug|x64.Build.0 = Debug|x64
15.8 {B54F4A89-7357-4879-AE62-0825AD3E5974}.Release|Win32.ActiveCfg = Release|Win32
15.9 {B54F4A89-7357-4879-AE62-0825AD3E5974}.Release|Win32.Build.0 = Release|Win32
15.10 {B54F4A89-7357-4879-AE62-0825AD3E5974}.Release|x64.ActiveCfg = Release|x64
15.11 + {B54F4A89-7357-4879-AE62-0825AD3E5974}.Release|x64.Build.0 = Release|x64
15.12 EndGlobalSection
15.13 GlobalSection(SolutionProperties) = preSolution
15.14 HideSolutionNode = FALSE
16.1 Binary file server/windows/USBEventSvc/USBEventSvc.v12.suo has changed
17.1 Binary file server/windows/USBEventSvc/Win32/Debug/OpenSecUSBEventSvc.exe has changed
18.1 Binary file server/windows/USBEventSvc/Win32/Debug/OpenSecUSBEventSvcLog.dll has changed
19.1 Binary file server/windows/USBEventSvc/Win32/Release/OpenSecUSBEventSvc.exe has changed
20.1 Binary file server/windows/USBEventSvc/Win32/Release/OpenSecUSBEventSvcLog.dll has changed
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
21.2 +++ b/server/windows/USBEventSvc/install.sh Fri Feb 21 11:04:04 2014 +0100
21.3 @@ -0,0 +1,5 @@
21.4 +#!/bin/bash
21.5 +sc stop OpenSecUSBEventSvc
21.6 +sc delete OpenSecUSBEventSvc
21.7 +./OpenSecUSBEventSvc install
21.8 +sc start OpenSecUSBEventSvc
22.1 Binary file server/windows/USBEventSvc/x64/Debug/OpenSecUSBEventSvc.exe has changed
23.1 Binary file server/windows/USBEventSvc/x64/Debug/OpenSecUSBEventSvc.ilk has changed
24.1 Binary file server/windows/USBEventSvc/x64/Debug/OpenSecUSBEventSvc.pdb has changed
25.1 Binary file server/windows/USBEventSvc/x64/Debug/OpenSecUSBEventSvcLog.dll has changed
26.1 Binary file server/windows/USBEventSvc/x64/Release/OpenSecUSBEventSvc.exe has changed
27.1 Binary file server/windows/USBEventSvc/x64/Release/OpenSecUSBEventSvc.pdb has changed
28.1 Binary file server/windows/USBEventSvc/x64/Release/OpenSecUSBEventSvcLog.dll has changed