WDM プリンタINFファイル解析一般 新しいページはコチラ
提供: yonewiki
(→Installer Sections) |
(→Copy Sections) |
||
| 616行: | 616行: | ||
| + | |||
| + | ==== ''' [DestinationDirs] '''==== | ||
| + | ファイルのコピー先を指定する部分です。DefaultDestDir=66000は既定の配布先を指定するもので66000はプリンタドライバの配置をする既定のディレクトリ名を示します。番号が特定のディレクトリ名を保持していて、この番号によるディレクトリ名指定の管理はかなりの数が登録されています。66000はGetPrinterDriverDirectoryというAPIを実行して返却される値です。Windows10のamd64アーキテクチャーの場合はC:\Windows\System32\spool\drivers\x64が返ってきます。 | ||
| + | |||
| + | |||
| + | <syntaxhighlight2 lang="VBA"> | ||
| + | Declare PtrSafe Function BeepAPI Lib "kernel32.dll" Alias "Beep" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long | ||
| + | Declare PtrSafe Function GetPrinterDriverDirectory Lib "winspool.drv" Alias "GetPrinterDriverDirectoryA" _ | ||
| + | (ByVal pName As String, _ | ||
| + | ByVal pEnvironment As String, _ | ||
| + | ByVal level As Long, _ | ||
| + | ByVal pDriverDirectory As String, _ | ||
| + | ByVal cbBuff As Long, _ | ||
| + | pcbNeeded As Long) As Long | ||
| + | |||
| + | Sub GetDir() | ||
| + | Dim level As Long | ||
| + | Dim cbBuff As Long | ||
| + | Dim pcbNeeded As Long | ||
| + | Dim pName As String | ||
| + | Dim pEnvironment As String | ||
| + | Dim pDriverDirectory As String | ||
| + | |||
| + | 'initialization to determine size of buffer required | ||
| + | level = 1 'must be 1 | ||
| + | cbBuff = 0 'must be 0 initially | ||
| + | pDriverDirectory = vbNullString 'must be null string initially | ||
| + | |||
| + | 'string that specifies the name of the | ||
| + | 'server on which the printer driver resides. | ||
| + | 'If this parameter is vbNullString the | ||
| + | 'local driver-directory path is retrieved. | ||
| + | pName = vbNullString | ||
| + | |||
| + | 'string that specifies the environment | ||
| + | '(for example, "Windows NT x86", "Windows NT R4000", | ||
| + | '"Windows NT Alpha_AXP", or "Windows 4.0"). If | ||
| + | 'this parameter is NULL, the current environment | ||
| + | 'of the calling application and client machine | ||
| + | '(not of the destination application and print | ||
| + | 'server) is used. | ||
| + | pEnvironment = vbNullString | ||
| + | |||
| + | 'find out how large the buffer | ||
| + | 'needs to be (pcbNeeded). Call will return 0. | ||
| + | If GetPrinterDriverDirectory(pName, _ | ||
| + | pEnvironment, _ | ||
| + | level, _ | ||
| + | pDriverDirectory, _ | ||
| + | cbBuff, _ | ||
| + | pcbNeeded) = 0 Then | ||
| + | |||
| + | |||
| + | 'create a buffer large enough for the | ||
| + | 'string and a trailing null | ||
| + | pDriverDirectory = Space$(pcbNeeded) | ||
| + | cbBuff = Len(pDriverDirectory) | ||
| + | |||
| + | 'call again. Success = 1 | ||
| + | If GetPrinterDriverDirectory(pName, _ | ||
| + | pEnvironment, _ | ||
| + | level, _ | ||
| + | pDriverDirectory, _ | ||
| + | cbBuff, _ | ||
| + | pcbNeeded) = 1 Then | ||
| + | |||
| + | 'result | ||
| + | Text1 = Left$(pDriverDirectory, pcbNeeded) | ||
| + | |||
| + | End If 'GetPrinterDriverDirectory/2 | ||
| + | End If 'GetPrinterDriverDirectory/1 | ||
| + | |||
| + | End Sub | ||
| + | |||
| + | |||
| + | |||
| + | </syntaxhighlight2> | ||
=== ''' NTPRINT.INI '''=== | === ''' NTPRINT.INI '''=== | ||