Search the Community
Showing results for tags 'Driver'.
-
Hello. I did create these few functions several months ago. I post here, if it can interest someone. These functions based on WMI queries allow you to manage printers : add / delete printer, driver, port, or obtain configuration, set default printer ... I let you discover it with the code. Here is the list of the available functions : _PrintMgr_AddLocalPort _PrintMgr_AddLPRPort _PrintMgr_AddPrinter _PrintMgr_AddPrinterDriver _PrintMgr_AddTCPIPPrinterPort _PrintMgr_AddWindowsPrinterConnection _PrintMgr_CancelAllJobs _PrintMgr_CancelPrintJob _PrintMgr_EnumPorts _PrintMgr_EnumPrinter _PrintMgr_EnumPrinterConfiguration _PrintMgr_EnumPrinterDriver _PrintMgr_EnumPrinterProperties _PrintMgr_EnumPrintJobs _PrintMgr_EnumTCPIPPrinterPort _PrintMgr_Pause _PrintMgr_PortExists _PrintMgr_PrinterExists _PrintMgr_PrinterSetComment _PrintMgr_PrinterSetDriver _PrintMgr_PrinterSetPort _PrintMgr_PrinterShare _PrintMgr_PrintTestPage _PrintMgr_RemoveLocalPort _PrintMgr_RemoveLPRPort _PrintMgr_RemovePrinter _PrintMgr_RemovePrinterDriver _PrintMgr_RemoveTCPIPPrinterPort _PrintMgr_RenamePrinter _PrintMgr_Resume _PrintMgr_SetDefaultPrinter And some examples : #include <Array.au3> #include "PrintMgr.au3" _Example() Func _Example() ; Remove a printer called "My old Lexmark printer" : _PrintMgr_RemovePrinter("My old Lexmark printer") ; Remove the driver called "Lexmark T640" : _PrintMgr_RemovePrinterDriver("Lexmark T640") ; Remove the TCP/IP printer port called "TCP/IP" _PrintMgr_RemoveTCPIPPrinterPort("MyOLDPrinterPort") ; Add a driver, called "Samsung ML-451x 501x Series", and driver inf file is ".\Samsung5010\sse2m.inf" _PrintMgr_AddPrinterDriver("Samsung ML-451x 501x Series", "Windows NT x86", @ScriptDir & "\Samsung5010", @ScriptDir & "\Samsung5010\sse2m.inf") ; Add a TCP/IP printer port, called "MyTCPIPPrinterPort", with IPAddress = 192.168.1.10 and Port = 9100 _PrintMgr_AddTCPIPPrinterPort("MyTCPIPPrinterPort", "192.168.1.10", 9100) ; Add a printer, give it the name "My Printer", use the driver called "Samsung ML-451x 501x Series" and the port called "MyTCPIPPrinterPort" _PrintMgr_AddPrinter("My Printer", "Samsung ML-451x 501x Series", "MyTCPIPPrinterPort") ; Set the printer called "My Printer" as default printer _PrintMgr_SetDefaultPrinter("My Printer") ; Connect to the shared printer "\\192.168.1.1\HPDeskjetColor") _PrintMgr_AddWindowsPrinterConnection("\\192.168.1.1\HPDeskjetColor") ; List all installed printers Local $aPrinterList = _PrintMgr_EnumPrinter() _ArrayDisplay($aPrinterList) ; List all printers configuration Local $aPrinterConfig = _PrintMgr_EnumPrinterConfiguration() _ArrayDisplay($aPrinterConfig) ; List all installed printer drivers Local $aDriverList = _PrintMgr_EnumPrinterDriver() _ArrayDisplay($aDriverList) ; Retrieve the printer configuration for the printer called "Lexmark T640" $aPrinterConfig = _PrintMgr_EnumPrinterConfiguration("Lexmark T640") _ArrayDisplay($aPrinterConfig) ; Add a local printer port (for a file output) _PrintMgr_AddLocalPort("c:\temp\output.pcl") ; Remove the local port _PrintMgr_RemoveLocalPort("c:\temp\output.pcl") ; Enum a print job Local $aJobList = _PrintMgr_EnumPrintJobs() _ArrayDisplay($aJobList) EndFunc ;==>_Example Download link : PrintMgr_Example.au3 PrintMgr.au3
-
I want to print all visible files and folders in a drive to a txt file. What I mean by visible is that there are 3 files and 2 folders in this drive, but there are 500 files in the folders. I only want to print 3 files and 2 folders. I don't want the contents of the folder to be printed. please help me.
-
How can I open a specific driver with Autoit, in my case I have an usb which has the driver letter of f.
-
Is there any library or api in Autoit to check whether a particular driver is signed or not and check for the certificate validity of the driver/catalog file if it is signed.?
- 3 replies
-
- certificate
- driver
-
(and 1 more)
Tagged with:
-
Process + Thread + DLL Functions UDFs Fully tested on O/S's from Windows 2000 -> Windows 7, in both 32-bit and 64-bit modes. *Note: the dropdown box in the GUI has issues in Windows 2000 - workaround - type 1st letter of process. Also, RemoteThreads may not start if Terminal Services is not installed on Win2000. This is a compilation of all my Process, Thread, and DLL functions (and now Driver functions) into a number of UDF modules. Most every and anything useful can be done with these functions. The best part is the GUI interfaces (ProcessFunctionsTest, ThreadFunctionsTest) which let you experiment with what functions do without even touching a line of code. And whats that? Oh yes - it creates Threads. Even 'Wow64' threads, which requires a new way of thinking =) Bundled with the core Process, Thread, and DLL UDF's are numerous support functions, examples, and even a DLL Injection module. A comparison program 'ProcessListPropertiesTest' is also included for comparison against PsaltyDS's _ProcessListProperties UDF). The GUI's pictured above are the best way to explore the possible uses of the Process + Thread functions included, but the functionality extends beyond those default function calls. For example, there are more filters for the 'List' functions, plus other functionality that is not exposed in the GUI examples. There's also the DLL Functions which aren't even touched on (but are made use of nonetheless). *For another example use of the Process Functions UDF see the ProcessGetWinPEImportExports UDF. Below is a list of all the functions available (check the function headers for more info): ProcessFunctions UDF's Thread Functions UDF's DLL Functions UDF's DriverList.au3 UDF: ; _DriverList() ; Returns a list of Drivers that were loaded by the O/S This is now a very comprehensive suite. Most everything a programmer or user would find useful is included. If by chance you can think of *any* other (useful) functions to add to this project, however, let me know. For those that need to measure a Process's CPU Usage, please see my PDH Performance Counters UDF, another comprehensive UDF suite. Special note: For most all _Process* functions that require a 'QUERY' info handle, use the constant $PROCESS_QUERY_LIMITED_INFO, which is set based on O/S. There's only one exception to this that I can think of: _ProcessMemoryVirtualQuery() which requires full Query access no matter what O/S (0x400). Thread* functions can make use of 2 constants which are set based on O/S - $THREAD_QUERY_LIMITED_INFO and $THREAD_SET_LIMITED_INFO. Experiment with the GUI's on Vista+ O/S's to see what's the minimum req's. Download the Source and/or GUI Exe's from my site Optional addition: Special NomadMemory UDF designed to work with ProcessFunctions: NomadMemoryPF.au3 Ascend4nt's AutoIT Code License agreement: While I provide this source code freely, if you do use the code in your projects, all I ask is that: If you provide source, keep the header as I have put it, OR, if you expand it, then at least acknowledge me as the original author, and any other authors I creditIf the program is released, acknowledge me in your credits (it doesn't have to state which functions came from me, though again if the source is provided - see #1)The source on it's own (as opposed to part of a project) can not be posted unless a link to the page(s) where the code were retrieved from is provided and a message stating that the latest updates will be available on the page(s) linked to.Pieces of the code can however be discussed on the threads where Ascend4nt has posted the code without worrying about further linking.UPDATES:
-
How do I convert this to autoit? I've seen people here post examples (Manko) of communicating with device drivers, but this is ridiculously complex! #define CODEMSG(_digitval) CTL_CODE(FILE_DEVICE_UNKNOWN,_digitval , METHOD_BUFFERED,\ FILE_READ_DATA | FILE_WRITE_DATA) #define CODE_VALUE 4094 //handle to driver HANDLE device = 0; char ret[1024]; WCHAR SendValue[512]; DWORD codeval, bytes; if( !strcmp(argv[i],"-p") ) { codeval = CODE_VALUE; i++; continue; } MultiByteToWideChar(CP_ACP, 0, argv[i], -1, SendValue, sizeof(SendValue)); DeviceIoControl(device, CODEMSG(codeval), SendValue, (wcslen(SendValue)+1)*2, &ret, sizeof(ret),&bytes,NULL); The farthest I've got is~ #Include <WinAPI.au3> $Handle = _LoadDriver() $Struc = DllStructCreate("char[1024];WCHAR[512];DWORD") DllStructSetData($Struc, 3, _WinAPI_MultiByteToWideChar("I have no idea what I'm doing" , 0, $MB_PRECOMPOSED , true)) MsgBox(0,"",DllStructGetPtr($Struc)) $ret = DllCall("kernel32.dll", "int", "DeviceIoControl", _ "dword", $Handle, _ "dword", DllStructGetPtr($Struc,3), _ "ptr", DllStructGetPtr($Struc), _ "dword", 12, _ "ptr", DllStructGetPtr($Struc), _ "dword", 12, _ "dword*", 0, _ "ptr", 0) Until I slowly started to realize I have absolutely no idea what I'm doing.
-
Hey guys, I'm trying to use the delete files same time in Removable or change attrib to show. ex: delete : Autorun.inf ===> Attrib = SH in Removable this is try me : #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.6.1 Author: GHOST SKIKDA Script Function: Hide Files System in Removable. #ce ---------------------------------------------------------------------------- #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <GuiStatusBar.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 554, 454, 192, 114) GUISetBkColor(0x000000) $ListView1 = GUICtrlCreateListView("Name|Status", 16, 168, 522, 270, '', BitOR($WS_EX_CLIENTEDGE,$LVS_EX_GRIDLINES)) _GUICtrlListView_SetExtendedListViewStyle(-1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES)) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 400) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 100) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x00FF00) GUICtrlSetBkColor(-1, 0x800000) $ListView1context = GUICtrlCreateContextMenu($ListView1) $MenuItem1 = GUICtrlCreateMenuItem("Show", $ListView1context) $MenuItem2 = GUICtrlCreateMenuItem("Hide", $ListView1context) $MenuItem3 = GUICtrlCreateMenuItem("Delete", $ListView1context) $Button1 = GUICtrlCreateButton("Scan", 462, 134, 75, 25, $WS_GROUP) $Combo1 = GUICtrlCreateCombo("", 50, 136, 409, 25) $Label1 = GUICtrlCreateLabel("Path : ", 16, 139, 35, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFF0000) $StatusBar1 = _GUICtrlStatusBar_Create($Form1) Dim $StatusBar1_PartsWidth[1] = [-1] _GUICtrlStatusBar_SetParts($StatusBar1, $StatusBar1_PartsWidth) _drivercombo() GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 _GUICtrlListView_DeleteAllItems($ListView1) Sleep(200) ;Search("f:\") _driver() Case $ListView1 EndSwitch WEnd ;~ Func _Search() ;~ $search = FileFindFirstFile("C:\*.*") ;~ If $search = -1 Then ;~ MsgBox(0, "Error", "No files/directories matched the search pattern") ;~ Exit ;~ EndIf ;~ $com=0 ;~ While 1 ;~ $file = FileFindNextFile($search) ;~ If @error Then ExitLoop ;~ $var = FileGetAttrib("C:\"&$file) ;~ If ($var = "RASH") or ($var = "SH") Then ;~ _GUICtrlListView_AddItem($ListView1, $file, $com) ;~ _GUICtrlListView_AddSubItem($ListView1, $com,$var, 1) ;~ ;_GUICtrlListView_SetItemChecked($ListView1, $com) ;~ $com=$com+1 ;~ EndIf ;~ WEnd ;~ FileClose($search) ;~ _GUICtrlStatusBar_SetText($StatusBar1, @TAB & "Resultat = " & _GUICtrlListView_GetItemCount($ListView1), 0) ;~ EndFunc Func Search($current) Local $search = FileFindFirstFile($current & "\*.*") $com=0 While 1 Dim $file = FileFindNextFile($search) If @error Or StringLen($file) < 1 Then ExitLoop $var = FileGetAttrib($current &"\"&$file) If ($var = "RASH") or ($var = "SH") or ($var = "RAH") or ($var = "ASH") Then;StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") and _GUICtrlListView_AddItem($ListView1, $file, $com) _GUICtrlListView_AddSubItem($ListView1, $com,$var, 1) ;_GUICtrlListView_SetItemChecked($ListView1, $com) $com=$com+1 Search($current & "\" & $file) EndIf Sleep (1) _GUICtrlStatusBar_SetText($StatusBar1, @TAB & "Resultat = " & _GUICtrlListView_GetItemCount($ListView1), 0) WEnd EndFunc Func _driver() $drv = DriveGetDrive( "Removable") If NOT @error Then For $i = 2 to $drv[0] GUICtrlSetData($Combo1,$drv[$i]) Search($drv[$i]) Next EndIf EndFunc Func _drivercombo() $drv = DriveGetDrive( "Removable") If NOT @error Then For $i = 2 to $drv[0] GUICtrlSetData($Combo1,$drv[$i]) Next EndIf EndFunc