var Process = (function(){
	var shell = loadActiveX({
			name: 'Wscript.shell'
		}),
		swbemlocator = loadActiveX({
			name: 'wbemscripting.swbemlocator'
		}),
		wmiservice = swbemlocator.ConnectServer('.', '\\root\\cimv2');
		
	return {
		getList: function(condition){
			if(condition){
				condition = ' where ' + condition;
			}else{
				condition = '';
			}
			
			var items = new Enumerator(wmiservice.ExecQuery('Select * from win32_process' + condition)),
				item,
				arr = [];
				
			while(!items.atEnd()){
				var item = items.item();
				arr.push({
					handle: item.handle,
					caption: item.caption
				});
				items.moveNext();
			}
			return arr;
		},
		getAttr: function(handleId, attrName){
			var item = new Enumerator(wmiservice.execquery('select * from win32_process where handle=' + handleId)).item();
			return item[attrName];
		}
	}
})();