Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

FileDisk virtual disk driver for Windows NT/2K/X

- - - - -

  • Please log in to reply
24 replies to this topic

#1
Bilou_Gateux

Bilou_Gateux

    Powered by Windows Embedded

  • Member
  • PipPipPipPipPip
  • 768 posts
  • Joined 03-January 04
FileDisk by Bo Branten
FileDisk is a virtual disk driver for Windows NT/2000/XP that uses one or more files to emulate physical disks. A console application is included that let you dynamically mount and unmount files. FileDisk can also use CD-images.
Latest news: Works on Windows XP, FileDisk images can be stored on network drives, support for CD-images, support for UNC paths, support for sparse files.

FileDiskExt.dll shell extension to handle iso files written by Sherpya.
Note: Sherpya plug-in is written for WinPe and the inf file should be modifed for use with regular Windows.

You can try my own FileDisk.inf installer (FileDiskExt.dll renamed to FileDisk.dll) to copy three files and install the Shell Extension.
; Inf file author: Bilou Gateux 
;
; FileDisk by Bo Branten
; http://www.acc.umu.se/~bosse/
; FileDisk Shell Extension by Sherpya
; http://oss.netfarm.it/winpe/

; uninstall feature don't works 
; 

[version]
signature="$Chicago$"
SetupClass=BASE
AdvancedINF=2.5, "%ERROR_WRONG_ADVPACK_VERSION%"

[DefaultInstall]
RequiredEngine	= Setupapi,%ERROR_ENGINE_NOTFOUND%
CopyFiles=ThisDll.ShellExt.Install,ThisDll.inf.install,ThisDll.exe.install,ThisDll.sys.install
AddReg=ThisDll.Add.Reg,ThisDll.Uninst.Reg

[DefaultUninstall]
DelFiles=ThisDll.ShellExt.Install,ThisDll.inf.install,ThisDll.exe.install,ThisDll.sys.install
DelReg=ThisDll.Add.Reg,ThisDll.Uninst.Reg

[ThisDll.Add.Reg]
HKCR,CLSID\{844449EE-53BC-4b46-8AC4-EAF476C1CF3B},,,"%Content_DESC%"
HKCR,CLSID\{844449EE-53BC-4b46-8AC4-EAF476C1CF3B}\InProcServer32,,,"%11%\%SubDir%\%ThisDll%"
HKCR,CLSID\{844449EE-53BC-4b46-8AC4-EAF476C1CF3B}\InProcServer32,ThreadingModel,,"Apartment"

HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\ShellExtensions\Approved"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\ShellExtensions\Approved",{844449EE-53BC-4b46-8AC4-EAF476C1CF3B},,%Content_DESC%

HKCR,.iso,,,"ISOImage"
HKCR,.iso,"InfoTip",,%FileDiskTIPS%

HKCR,ISOImage\,,,%ISOImage%
HKCR,ISOImage\CLSID,,,"{844449EE-53BC-4b46-8AC4-EAF476C1CF3B}"
HKCR,ISOImage\DefaultIcon,,,"%11%\%SubDir%\%ThisDll%,-4"

HKCR,ISOImage\Shell\Open,,,""
HKCR,ISOImage\Shell\Open\Command,,,"rundll32 %11%\%SubDir%\%ThisDll%,MountIso %L"

HKCR,ISOImage\ShellEx\ContextMenuHandlers\{844449EE-53BC-4b46-8AC4-EAF476C1CF3B},,,""

HKCR,Drive\Shellex\ContextMenuHandlers\FileDisk
HKCR,Drive\Shellex\ContextMenuHandlers\FileDisk,,,{844449EE-53BC-4b46-8AC4-EAF476C1CF3B}

[ThisDll.Uninst.Reg]
HKLM,SoftWare\Microsoft\Windows\CurrentVersion\Uninstall\FileDiskExt,,,
HKLM,SoftWare\Microsoft\Windows\CurrentVersion\Uninstall\FileDiskExt,"DisplayName",,%Content_DESC%
HKLM,SoftWare\Microsoft\Windows\CurrentVersion\Uninstall\FileDiskExt,"UninstallString",,"rundll.exe setupx.dll,InstallHinfSection DefaultUnInstall 4 %17%\filedisk.inf"

[ThisDll.ShellExt.Install]
FileDisk.dll

[ThisDll.inf.install]
FileDisk.inf

[ThisDll.exe.install]
FileDisk.exe

[ThisDll.sys.install]
FileDisk.sys

[DestinationDirs]
ThisDll.ShellExt.Install=11,%SubDir%; to System32\%SubDir%
ThisDll.exe.Install=11; to System32
ThisDll.sys.install=11,%Drivers%; to System32\Drivers
ThisDll.inf.install=17; Inf SubDir

[SourceDisksNames]
55="FileDisk 1.1","",1

[SourceDisksFiles]
%ThisDll%=55

[Strings]
Content_DESC = "FileDisk"
SubDir = "ShellExt"
Drivers = "Drivers"
ThisDll = "FileDisk.dll"
ISOImage = "CD-ROM ISO Image"
FileDiskTIPS = "FileDisk"
Reg_Path_Run = "Software\Microsoft\Windows\CurrentVersion\RunOnce\Setup"

Installation:
Extract FileDisk.exe FileDisk.sys and FilediskExt.dll from Sherpya filedisk-1.1.cab archive to a temp folder, Rename FileDiskExt.dll to FileDisk.dll, copy and paste my code edit and save it to filedisk.inf, copy and paste my code edit and save it to filedisk.cmd
To install the kernel-mode device driver FileDisk.sys, i'm using INSTDRVW.EXE console tool:
FILEDISK.CMD
ECHO OFF
:: FileDisk is a virtual disk driver for Windows NT/2000/XP that uses one or more files to emulate physical disks.
:: http://www.acc.umu.se/~bosse/
:: Copy files and set registry keys and values
rundll32 advpack.dll,LaunchINFSection .\filedisk.inf ,DefaultInstall
:: Install Kernel-Mode Device Driver
INSTDRVW.EXE FileDisk %SYSTEMROOT%\SYSTEM32\DRIVERS\filedisk.sys
:: Set Number of Devices
REG ADD "HKLM\SYSTEM\CurrentControlSet\Services\FileDisk\Parameters" /v NumberOfDevices /t REG_DWORD /d 4 /f

OS Version = 5.1.2600 Service Pack 3
Platform ID = 2 (NT)
Service Pack = 3.0
Suite = 0x0140
Product Type = 1
Architecture = x86


How to remove advertisement from MSFN

#2
jaclaz

jaclaz

    The Finder

  • Developer
  • 15,017 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag
It looks like a nice tool.

jaclaz

#3
Bilou_Gateux

Bilou_Gateux

    Powered by Windows Embedded

  • Member
  • PipPipPipPipPip
  • 768 posts
  • Joined 03-January 04
Very useful for mounting ISO image of software install CD from a network share and then install it unattended on ultra-notebook without CD-Drive.

!mount CODE
Copy, Paste and save to !mount.cmd in the same subdir where the iso image stays.
OS Version = 5.1.2600 Service Pack 3
Platform ID = 2 (NT)
Service Pack = 3.0
Suite = 0x0140
Product Type = 1
Architecture = x86

#4
Bilou_Gateux

Bilou_Gateux

    Powered by Windows Embedded

  • Member
  • PipPipPipPipPip
  • 768 posts
  • Joined 03-January 04
Office 2003 Professional Network Install
OS Version = 5.1.2600 Service Pack 3
Platform ID = 2 (NT)
Service Pack = 3.0
Suite = 0x0140
Product Type = 1
Architecture = x86

#5
jaclaz

jaclaz

    The Finder

  • Developer
  • 15,017 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag
This could be another nice idea on how to use it:
http://www.911cd.net...showtopic=10705
(Saving a NTFS compressed "Programs" directory on CD to save space)

jaclaz

#6
Bilou_Gateux

Bilou_Gateux

    Powered by Windows Embedded

  • Member
  • PipPipPipPipPip
  • 768 posts
  • Joined 03-January 04
Yes it's another idea i would like to use.
As filedisk can handle IMG files (and not only ISO), we can store some valuable data into an img file and mount it when needed. No left data on the local Hard Drive.
I need to have the ability to use command line tool to run it unattended. Reading the features of TrueCrypt, it seems possible to use it with command lines. :)
OS Version = 5.1.2600 Service Pack 3
Platform ID = 2 (NT)
Service Pack = 3.0
Suite = 0x0140
Product Type = 1
Architecture = x86

#7
buletov

buletov

    Senior Member

  • Member
  • PipPipPipPip
  • 518 posts
  • Joined 08-September 04
what about drive letters? can they be preselected?
Power, power, the law of the land,
Those living for death will die by their own hand.
Life's no ordeal if you come to terms;
Reject the system dictating the norms.

#8
XPect

XPect

    Junior

  • Member
  • Pip
  • 80 posts
  • Joined 18-June 04
2 comments:

For mounting images, why not to use Vitual Clone Drive from Slysoft (Free) ? Seem to be more porwerfull in terms of CD images types handling capacity. Or DaemonTools but limited to ISO.

For valuable data, I suggest to use encrypted volumes rather than just imgs. For such uses jetico products (Bestcrypt) are good, but you can also use Cryptainer (LE is free but limited) or other tools.

#9
Bilou_Gateux

Bilou_Gateux

    Powered by Windows Embedded

  • Member
  • PipPipPipPipPip
  • 768 posts
  • Joined 03-January 04

2 comments:

For mounting images, why not to use Vitual Clone Drive from Slysoft (Free) ? Seem to be more porwerfull in terms of CD images types handling capacity. Or DaemonTools but limited to ISO.

For valuable data, I suggest to use encrypted volumes rather than just imgs. For such uses jetico products (Bestcrypt) are good, but you can also use Cryptainer (LE is free but limited) or other tools.

Need only a fast command line tool to mount standard ISO images during UA install. I don't want (need) any GUI. End users don't need to have access to this kind of tools on the installed boxes.
Installing the ShellExtension DLL is not mandatory.
As pointed by Jaclaz, TrueCrypt seems to be a good solution for mounting encrypted containers from the command line.
For my own usage, i can use various solutions.

@buletov
Is your question related to my batch files using filedisk ?
IF :yes: you can hardcoding the letter of mounted image in !mount.cmd batch file.
Just replace %FirstAvailableDriveLetter% with the letter you want to use. I have set the letter through variable to be more versatile.
OS Version = 5.1.2600 Service Pack 3
Platform ID = 2 (NT)
Service Pack = 3.0
Suite = 0x0140
Product Type = 1
Architecture = x86

#10
jaclaz

jaclaz

    The Finder

  • Developer
  • 15,017 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag
For RAW images, not ISO, I still prefer Ken Kato's VDK one:
http://www.msfn.org/...topic=26216&hl=
as it can be installed, started, stopped, etc. directly.

As ken's is a derivative from Bo's Filedisk, I wonder if it can be "extended" to read ISO files too.

@Bilou_Gateux
I have updated the pseudo GUI for ken's VDK, you can find it at the above link.

jaclaz

#11
arndt

arndt
  • Member
  • 4 posts
  • Joined 13-February 05
Hi @all,

i need help with filedisk. Does anybody know how to use junction points in combination with filedisk. (e.g. mount image to %SystemDrive%\Programs), or does anybody knows an other commandlinetool to mount imagefiles?

Greetz + thanks in advance

Arndt

#12
jaclaz

jaclaz

    The Finder

  • Developer
  • 15,017 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag
Once the image has been mounted and assigned a drive letter, junction should work allright.
You can try Ken Kato's VDK (see my post above) too.

The problem is, if I am not mistaken, is that junctions ONLY work on the same volume.

jaclaz

#13
arndt

arndt
  • Member
  • 4 posts
  • Joined 13-February 05
Thanks for your answer. I expected something like this :(

#14
jaclaz

jaclaz

    The Finder

  • Developer
  • 15,017 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag
@arndt

Have a look here:
http://shell-shocked...icle.php?id=284

Maybe a Symbolic link might work for you.

jaclaz

#15
arndt

arndt
  • Member
  • 4 posts
  • Joined 13-February 05
Thank you,

but as i realized this day, junction points (or symlinks) are a ntfs5 feature.

The real story is that Windows has had symbolic links since Windows 2000, or more specifically, NTFS 5.0.

I needed soething like this for cdfs, so i guess there is no way for me...

#16
jaclaz

jaclaz

    The Finder

  • Developer
  • 15,017 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

I needed soething like this for cdfs, so i guess there is no way for me...


Actually there is something like that, it only applies to files, it is used widely in Microsoft distribution CDs, and implemented in their "internal use only" CDIMAGE.

The purpose is, if you have the SAME file in ore than one directory, all occurrences of the file but one are sustituted by a link pointing to the remaining file.

If I recall correctly, this feature is present in mkisofs windows port too:
http://www.bootcd.us...ofs_options.htm
(you might need some search to find the full man page)


Cannot say if this is what you are looking for, though.

jaclaz

#17
arndt

arndt
  • Member
  • 4 posts
  • Joined 13-February 05
I know these tools and they work realy fine. But they don't offer a possibility to link to an file/folder outside the cdrom, at least as far as i know.

#18
jaclaz

jaclaz

    The Finder

  • Developer
  • 15,017 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag
Yes,
what you need is something more like the good old "SUBST" DOS command.

I don't think such a file/directory redirector exists, or at least I was never been able to find it.

There are two softwares that ( I suppose) use something like this, Rescue 1.2 is now released as freeware (the one for Win98) whilst rescue 2 & 3 (for NT based systems) are Commercial:
http://www.qualystem...n/download.html

The other one is this:
http://www.apct.net/en/index.html
(site seems abandoned since 2002 i.e. before they made the XP version, but it is possible to download the demo version for Win2k up to SP2, free registration required)

jaclaz

#19
Methanoid

Methanoid

    Junior

  • Member
  • Pip
  • 88 posts
  • Joined 21-December 04
  • OS:none specified
Bilou and all, I'm actually looking at this for a slightly different application (putting game installs on DVDs).

I want to (without pre-installing a package like Daemontools) mount 2 ISO images, know WHICH drive letters they are and call an installer from the virtual drives.

Is there such a util? In the "old" DOS days I would have used CDEmu or FakeCD (IIRC)...

After install my script can install a noCD patch and unload the ISOs.

ANy ideas gents?

#20
jaclaz

jaclaz

    The Finder

  • Developer
  • 15,017 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag
Yep, and why does not filedisk work for you?

By default it starts with 4 devices....

...as you just need to mount 2 devices...

Could you be more precise?

jaclaz

#21
Methanoid

Methanoid

    Junior

  • Member
  • Pip
  • 88 posts
  • Joined 21-December 04
  • OS:none specified
According to the AUTHOR you have to load the device driver and boot again before loading disk images. I need something I can load, mount image, install from image and (possibly) unload.

As it was I solved the need for that one title I was doing but I'd still like to know IF there is a util that does what I want!

#22
pcuser_tom

pcuser_tom

    Newbie

  • Member
  • 19 posts
  • Joined 13-November 05
Here's the vb6 code that shows you how to register FileDisk.sys as a system service and start it without a need to reboot. Just add this module to your project and use RegSVC, StartSVC, StopSVC and UnRegSVC to register, start, stop and unregister FileDisk.sys as a system service. This code assumes that FileDisk.sys is in the same directory.

' Use "RegSVC, StartSVC, StopSVC and UnRegSVC

Option Explicit

Private Type OSVERSIONINFO
	dwOSVersionInfoSize As Long
	dwMajorVersion As Long
	dwMinorVersion As Long
	dwBuildNumber As Long
	dwPlatformId As Long
	szCSDVersion(1 To 128) As Byte
End Type
Private Const VER_PLATFORM_WIN32_NT = 2&

Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long

Private Declare Function ShellExecute Lib "shell32" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Private Const SW_SHOWNORMAL = 1&
Dim ServState As SERVICE_STATE, Installed As Boolean

Private Const ERROR_SERVICE_DOES_NOT_EXIST = 1060&
Private Const SERVICE_WIN32_OWN_PROCESS = &H10&
Private Const SERVICE_KERNEL_DRIVER = &H1&
Private Const SERVICE_WIN32_SHARE_PROCESS = &H20&
Private Const SERVICE_WIN32 = SERVICE_WIN32_OWN_PROCESS + _
								 SERVICE_WIN32_SHARE_PROCESS
Private Const SERVICE_FILE_SYSTEM_DRIVER = &H2&
Private Const SERVICE_ACCEPT_STOP = &H1
Private Const SERVICE_ACCEPT_PAUSE_CONTINUE = &H2
Private Const SERVICE_ACCEPT_SHUTDOWN = &H4
Private Const SC_MANAGER_CONNECT = &H1&
Private Const SC_MANAGER_CREATE_SERVICE = &H2&
Private Const SC_MANAGER_ENUMERATE_SERVICE = &H4
'Private Const SC_MANAGER_LOCK = &H8
'Private Const SC_MANAGER_QUERY_LOCK_STATUS = &H10
'Private Const SC_MANAGER_MODIFY_BOOT_CONFIG = &H20
Private Const STANDARD_RIGHTS_REQUIRED = &HF0000
Private Const SERVICE_QUERY_CONFIG = &H1&
Private Const SERVICE_CHANGE_CONFIG = &H2&
Private Const SERVICE_QUERY_STATUS = &H4&
Private Const SERVICE_ENUMERATE_DEPENDENTS = &H8&
Private Const SERVICE_START = &H10&
Private Const SERVICE_STOP = &H20&
Private Const SERVICE_PAUSE_CONTINUE = &H40&
Private Const SERVICE_INTERROGATE = &H80&
Private Const SERVICE_USER_DEFINED_CONTROL = &H100&
Private Const SERVICE_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or _
									   SERVICE_QUERY_CONFIG Or _
									   SERVICE_CHANGE_CONFIG Or _
									   SERVICE_QUERY_STATUS Or _
									   SERVICE_ENUMERATE_DEPENDENTS Or _
									   SERVICE_START Or _
									   SERVICE_STOP Or _
									   SERVICE_PAUSE_CONTINUE Or _
									   SERVICE_INTERROGATE Or _
									   SERVICE_USER_DEFINED_CONTROL)
Private Const SERVICE_AUTO_START As Long = 2
Private Const SERVICE_DEMAND_START As Long = 3
Private Const SERVICE_ERROR_NORMAL As Long = 1
Private Const ERROR_INSUFFICIENT_BUFFER = 122&
Private Enum SERVICE_CONTROL
	SERVICE_CONTROL_STOP = 1&
	SERVICE_CONTROL_PAUSE = 2&
	SERVICE_CONTROL_CONTINUE = 3&
	SERVICE_CONTROL_INTERROGATE = 4&
	SERVICE_CONTROL_SHUTDOWN = 5&
End Enum
Public Enum SERVICE_STATE
	SERVICE_STOPPED = &H1
	SERVICE_START_PENDING = &H2
	SERVICE_STOP_PENDING = &H3
	SERVICE_RUNNING = &H4
	SERVICE_CONTINUE_PENDING = &H5
	SERVICE_PAUSE_PENDING = &H6
	SERVICE_PAUSED = &H7
End Enum
Private Type SERVICE_STATUS
	dwServiceType As Long
	dwCurrentState As Long
	dwControlsAccepted As Long
	dwWin32ExitCode As Long
	dwServiceSpecificExitCode As Long
	dwCheckPoint As Long
	dwWaitHint As Long
End Type
Private Type QUERY_SERVICE_CONFIG
	dwServiceType As Long
	dwStartType As Long
	dwErrorControl As Long
	lpBinaryPathName As Long
	lpLoadOrderGroup As Long
	dwTagId As Long
	lpDependencies As Long
	lpServiceStartName As Long
	lpDisplayName As Long
End Type
Private Declare Function OpenSCManager _
	  Lib "advapi32" Alias "OpenSCManagerA" _
	  (ByVal lpMachineName As String, ByVal lpDatabaseName As String, _
	  ByVal dwDesiredAccess As Long) As Long
Private Declare Function CreateService _
	  Lib "advapi32" Alias "CreateServiceA" _
	  (ByVal hSCManager As Long, ByVal lpServiceName As String, _
	  ByVal lpDisplayName As String, ByVal dwDesiredAccess As Long, _
	  ByVal dwServiceType As Long, ByVal dwStartType As Long, _
	  ByVal dwErrorControl As Long, ByVal lpBinaryPathName As String, _
	  ByVal lpLoadOrderGroup As String, ByVal lpdwTagId As String, _
	  ByVal lpDependencies As String, ByVal lp As String, _
	  ByVal lpPassword As String) As Long
Private Declare Function DeleteService _
	  Lib "advapi32" (ByVal hService As Long) As Long
Private Declare Function CloseServiceHandle _
	  Lib "advapi32" (ByVal hSCObject As Long) As Long
Private Declare Function OpenService _
	  Lib "advapi32" Alias "OpenServiceA" _
	  (ByVal hSCManager As Long, ByVal lpServiceName As String, _
	  ByVal dwDesiredAccess As Long) As Long   '** Change SERVICE_NAME as needed
Private Declare Function QueryServiceConfig Lib "advapi32" _
	  Alias "QueryServiceConfigA" (ByVal hService As Long, _
	  lpServiceConfig As QUERY_SERVICE_CONFIG, _
	  ByVal cbBufSize As Long, pcbBytesNeeded As Long) As Long
Private Declare Function QueryServiceStatus Lib "advapi32" _
	(ByVal hService As Long, lpServiceStatus As SERVICE_STATUS) As Long
Private Declare Function ControlService Lib "advapi32" _
		(ByVal hService As Long, ByVal dwControl As SERVICE_CONTROL, _
		lpServiceStatus As SERVICE_STATUS) As Long
Private Declare Function StartService Lib "advapi32" _
		Alias "StartServiceA" (ByVal hService As Long, _
		ByVal dwNumServiceArgs As Long, ByVal lpServiceArgVectors As Long) As Long
Private Declare Function NetWkstaUserGetInfo Lib "Netapi32" (ByVal reserved As Any, ByVal Level As Long, lpBuffer As Any) As Long
Private Declare Function NetApiBufferFree Lib "Netapi32" (ByVal lpBuffer As Long) As Long

Private Declare Function lstrcpy Lib "kernel32" Alias "lstrcpyA" (ByVal lpString1 As Any, ByVal lpString2 As Any) As Long
Private Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As Any) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Private Declare Function lstrlenW Lib "kernel32" (ByVal lpString As Long) As Long

Private Const SERVICE_NAME As String = "FileDisk"
Private Const Service_Display_Name As String = "FileDisk"
Private Const Service_File_Name As String = "filedisk.sys"

Public AppPath As String

' This function returns current service status
' or 0 on error
Public Function GetServiceStatus() As SERVICE_STATE
Dim hSCManager As Long, hService As Long, Status As SERVICE_STATUS
hSCManager = OpenSCManager(vbNullString, vbNullString, _
					   SC_MANAGER_CONNECT)
If hSCManager <> 0 Then
	hService = OpenService(hSCManager, SERVICE_NAME, SERVICE_QUERY_STATUS)
	If hService <> 0 Then
		If QueryServiceStatus(hService, Status) Then
			GetServiceStatus = Status.dwCurrentState
		End If
		CloseServiceHandle hService
	End If
	CloseServiceHandle hSCManager
End If
End Function

' This function fills Service Account field in form.
' It returns nonzero value on error

Public Function GetServiceConfig() As Long
Dim hSCManager As Long, hService As Long
Dim r As Long, SCfg() As QUERY_SERVICE_CONFIG, r1 As Long, s As String

hSCManager = OpenSCManager(vbNullString, vbNullString, _
					   SC_MANAGER_CONNECT)
If hSCManager <> 0 Then
	hService = OpenService(hSCManager, SERVICE_NAME, SERVICE_QUERY_CONFIG)
	If hService <> 0 Then
		ReDim SCfg(1 To 1)
		If QueryServiceConfig(hService, SCfg(1), 36, r) = 0 Then
			If Err.LastDllError = ERROR_INSUFFICIENT_BUFFER Then
				r1 = r \ 36 + 1
				ReDim SCfg(1 To r1)
				If QueryServiceConfig(hService, SCfg(1), r1 * 36, r) <> 0 Then
					s = Space$(255)
					lstrcpy s, SCfg(1).lpServiceStartName
					s = left$(s, lstrlen(s))
				Else
					GetServiceConfig = Err.LastDllError
				End If
			Else
				GetServiceConfig = Err.LastDllError
			End If
		End If
		CloseServiceHandle hService
	Else
		GetServiceConfig = Err.LastDllError
	End If
	CloseServiceHandle hSCManager
Else
	GetServiceConfig = Err.LastDllError
End If
End Function

' This function installs service on local computer
' It returns nonzero value on error
Public Function SetNTService() As Long
Dim hSCManager As Long
Dim hService As Long, DomainName As String

hSCManager = OpenSCManager(vbNullString, vbNullString, _
					   SC_MANAGER_CREATE_SERVICE)
If hSCManager <> 0 Then
' Install service to manual start. To set service to autostart
' replace SERVICE_DEMAND_START to SERVICE_AUTO_START
	hService = CreateService(hSCManager, SERVICE_NAME, _
					   Service_Display_Name, SERVICE_ALL_ACCESS, _
					   SERVICE_KERNEL_DRIVER, _
					   SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL, _
					   App.Path & "\" & Service_File_Name, vbNullString, _
					   vbNullString, vbNullString, vbNullString, _
					   vbNullString)
			
	If hService <> 0 Then
		CloseServiceHandle hService
	Else
		SetNTService = Err.LastDllError
	End If
	CloseServiceHandle hSCManager
Else
	SetNTService = Err.LastDllError
End If
End Function

' This function uninstalls service
' It returns nonzero value on error
Public Function DeleteNTService() As Long
Dim hSCManager As Long
Dim hService As Long, Status As SERVICE_STATUS

hSCManager = OpenSCManager(vbNullString, vbNullString, _
					   SC_MANAGER_CONNECT)
If hSCManager <> 0 Then
	hService = OpenService(hSCManager, SERVICE_NAME, _
					   SERVICE_ALL_ACCESS)
	If hService <> 0 Then
' Stop service if it is running
		ControlService hService, SERVICE_CONTROL_STOP, Status
		If DeleteService(hService) = 0 Then
			DeleteNTService = Err.LastDllError
		End If
		CloseServiceHandle hService
	Else
		DeleteNTService = Err.LastDllError
	End If
	CloseServiceHandle hSCManager
Else
	DeleteNTService = Err.LastDllError
End If

End Function

' This function returns local network domain name
' or zero-length string on error
Public Function GetDomainName() As String
Dim lpBuffer As Long, l As Long, p As Long
If NetWkstaUserGetInfo(0&, 1&, lpBuffer) = 0 Then
	CopyMemory p, ByVal lpBuffer + 4, 4
	l = lstrlenW(p)
	If l > 0 Then
		GetDomainName = Space$(l)
		CopyMemory ByVal StrPtr(GetDomainName), ByVal p, l * 2
	End If
	NetApiBufferFree lpBuffer
End If
End Function

' This function starts service
' It returns nonzero value on error
Public Function StartNTService() As Long
Dim hSCManager As Long, hService As Long
hSCManager = OpenSCManager(vbNullString, vbNullString, _
					   SC_MANAGER_CONNECT)
If hSCManager <> 0 Then
	hService = OpenService(hSCManager, SERVICE_NAME, SERVICE_START)
	If hService <> 0 Then
		If StartService(hService, 0, 0) = 0 Then
			StartNTService = Err.LastDllError
		End If
	CloseServiceHandle hService
	Else
		StartNTService = Err.LastDllError
	End If
CloseServiceHandle hSCManager
Else
	StartNTService = Err.LastDllError
End If
End Function

' This function stops service
' It returns nonzero value on error
Public Function StopNTService() As Long
Dim hSCManager As Long, hService As Long, Status As SERVICE_STATUS
hSCManager = OpenSCManager(vbNullString, vbNullString, _
					   SC_MANAGER_CONNECT)
If hSCManager <> 0 Then
	hService = OpenService(hSCManager, SERVICE_NAME, SERVICE_STOP)
	If hService <> 0 Then
		If ControlService(hService, SERVICE_CONTROL_STOP, Status) = 0 Then
			StopNTService = Err.LastDllError
		End If
	CloseServiceHandle hService
	Else
		StopNTService = Err.LastDllError
	End If
CloseServiceHandle hSCManager
Else
	StopNTService = Err.LastDllError
End If
End Function

' change this to "Public Sub Main ()" if you don't need a form
Public Sub DoService()
RegSVC
StartSVC
'add your code here

StopSVC
UnRegSVC
End
End Sub

Private Sub CheckService()
	If GetServiceConfig() = 0 Then
		Installed = True
		ServState = GetServiceStatus()
		Select Case ServState
			Case SERVICE_RUNNING
			Case SERVICE_STOPPED
			Case Else
		End Select
	Else
		Installed = False
	End If
End Sub

Public Sub RegSVC()
	CheckService
	If Not Installed Then
		SetNTService
	End If
	CheckService
	'MsgBox ("It's installed")
End Sub

Public Sub UnRegSVC()
CheckService
If Installed Then
	DeleteNTService
End If
'MsgBox ("Now it's uninstalled")
End Sub

Public Sub StartSVC()
	CheckService
	If ServState = SERVICE_STOPPED Then
		StartNTService
	End If
	CheckService
	'MsgBox ("Now it's Started")
End Sub

Public Sub StopSVC()
	CheckService
	If ServState = SERVICE_RUNNING Then
		StopNTService
	End If
	CheckService
	'MsgBox ("Now it's Stopped")
End Sub

Here's the thread that explains why I needed this module
http://www.ubcd4win....opic=3271&st=15

Edited by pcuser_tom, 13 November 2005 - 01:30 PM.


#23
Bilou_Gateux

Bilou_Gateux

    Powered by Windows Embedded

  • Member
  • PipPipPipPipPip
  • 768 posts
  • Joined 03-January 04
Alternate link for instdrvw.exe:
W32 tools


link to pcuser_tom tool:
unISOfs.exe

Edited by Bilou_Gateux, 01 August 2006 - 09:29 AM.

OS Version = 5.1.2600 Service Pack 3
Platform ID = 2 (NT)
Service Pack = 3.0
Suite = 0x0140
Product Type = 1
Architecture = x86

#24
jaclaz

jaclaz

    The Finder

  • Developer
  • 15,017 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag
This guy jeffothy has put 'em all together:
http://www.jeffothy....sk-iso-mounter/

check this also:
http://www.benlaufer...24/filedisk-ua/

“FileDisk uA” is a WinRAR SFX that silently copies filedisk.exe and filedisk.sys to the correct directories and adds appropriate registry keys. It will also associate FileDisk with .iso files so you can mount them by just double clicking on the iso files. It will also add Mount/Unmount on First Device to the context menu for .iso files.



jaclaz

Edited by jaclaz, 20 August 2006 - 11:17 AM.


#25
chrime2007

chrime2007
  • Member
  • 2 posts
  • Joined 14-November 09
is there a amd64 build of the filedisk.exe anywhere? Is it possible to use the sourcecode to build a amd64? I need that for my 64bit winpe to mount images of 64bit windows setups. The driver is available in amd64 yet. Anybody can help to get a filedisk amd64 exe?

Thanks




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users