Welcome to MSFN

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.


Sign in to follow this  
Followers 0
Bilou_Gateux

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

25 posts in this topic

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

0

Share this post


Link to post
Share on other sites

It looks like a nice tool.

jaclaz

0

Share this post


Link to post
Share on other sites

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.

0

Share this post


Link to post
Share on other sites

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. :)

0

Share this post


Link to post
Share on other sites

what about drive letters? can they be preselected?

0

Share this post


Link to post
Share on other sites

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.

0

Share this post


Link to post
Share on other sites
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.

0

Share this post


Link to post
Share on other sites

For RAW images, not ISO, I still prefer Ken Kato's VDK one:

http://www.msfn.org/board/index.php?showtopic=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

0

Share this post


Link to post
Share on other sites

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

0

Share this post


Link to post
Share on other sites

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

0

Share this post


Link to post
Share on other sites

Thanks for your answer. I expected something like this :(

0

Share this post


Link to post
Share on other sites

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...

0

Share this post


Link to post
Share on other sites
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/Mkisofs_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

0

Share this post


Link to post
Share on other sites

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.

0

Share this post


Link to post
Share on other sites

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.com/en/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

0

Share this post


Link to post
Share on other sites

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?

0

Share this post


Link to post
Share on other sites

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

0

Share this post


Link to post
Share on other sites

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!

0

Share this post


Link to post
Share on other sites

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.com/forum/index.php?showtopic=3271&st=15

Edited by pcuser_tom
0

Share this post


Link to post
Share on other sites

This guy jeffothy has put 'em all together:

http://www.jeffothy.com/weblog/filedisk-iso-mounter/

check this also:

http://www.benlaufer.com/2006/04/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
0

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.