Bonjour à tous !

Tout d'abord, je tiens à vous présenter tous mes vœux pour cette nouvelle année 2017 avec une très bonne santé, de mon côté, j'aurai besoin de votre aide pour un problème dont je ne comprends pourquoi le débogueur m'affiche ce message.

J'ai trouvé sur le net un site proposant en Code Source l'utilisation du service Shadow Copy dont j'ai besoin pour créer mon application, j'ai donc téléchargé celui-ci et essayé de l'adapter en fonction de mon besoin en VB.Net.

Lors du test d'exécution du programme, le débogueur s'arrête sur une de mes fonctions et m'affiche le message d'erreur suivant : "Tentative de chargement d’un programme de format incorrect. (Exception de HRESULT : 0x8007000B)".

En faisant des recherches sur le Web, j'ai compris que mon problème était dû à la version mais ce que je ne comprends pas c'est tout correspond c'est à dire :

- OS Windows version 64 bits
- Dll du Shadow Copy en 64 bits
- Le code ci-dessous utilise la fonction System.UInt64

Code de la classe
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
 
Imports System.Runtime.InteropServices
Imports VSS
 
Public Class VSHADOW_VISTA64
    Implements ISHADOW
 
    Private Declare Auto Function _Version Lib "vShadow-Vista64.dll" Alias "Version" () As Integer
 
    Private Declare Auto Function _VSSInitializeForBackup Lib "vShadow-Vista64.dll" Alias "VSSInitializeForBackup" () As System.UInt64
 
    Private Declare Auto Function _VSSStartSnapshot Lib "vShadow-Vista64.dll" Alias "VSSStartSnapshot" _
                    (ByVal pwszVolumeName As String,
                     ByRef pidSnapShotSet As Guid,
                     ByRef pidSnapShot As Guid) As System.UInt64
 
    Private Declare Auto Function _VSSGetSnapShotDeviceName Lib "vShadow-Vista64.dll" Alias "VSSGetSnapShotDeviceName" _
                     (<[Out](), MarshalAs(UnmanagedType.BStr)> ByRef bstrDeviceName As String,
                      ByRef pidSnapShot As Guid) As System.UInt64
 
    Private Declare Auto Function _VSSDeleteAllSnapshots Lib "vShadow-Vista64.dll" Alias "VSSDeleteAllSnapshots" _
                     (ByRef pidSnapShotSet As Guid) As System.UInt64
 
    Private Declare Auto Function _VSSCloseBackup Lib "vShadow-Vista64.dll" Alias "VSSCloseBackup" () As System.UInt64
 
    Public Function Version() As Integer Implements ISHADOW.Version
        Return _Version
    End Function
 
    Public Function VSSCloseBackup() As ULong Implements ISHADOW.VSSCloseBackup
        Return _VSSCloseBackup
    End Function
 
    Public Function VSSDeleteAllSnapshots(ByRef pidSnapShotSet As System.Guid) As ULong Implements ISHADOW.VSSDeleteAllSnapshots
        Return _VSSDeleteAllSnapshots(pidSnapShotSet)
    End Function
 
    Public Function VSSGetSnapShotDeviceName(ByRef bstrDeviceName As String, ByRef pidSnapShot As System.Guid) As ULong Implements ISHADOW.VSSGetSnapShotDeviceName
        Return _VSSGetSnapShotDeviceName(bstrDeviceName, pidSnapShot)
    End Function
 
    Public Function VSSInitializeForBackup() As ULong Implements ISHADOW.VSSInitializeForBackup
        Return _VSSInitializeForBackup
    End Function
 
    Public Function VSSStartSnapshot(ByVal pwszVolumeName As String, ByRef pidSnapShotSet As System.Guid, ByRef pidSnapShot As System.Guid) As ULong Implements ISHADOW.VSSStartSnapshot
        Return _VSSStartSnapshot(pwszVolumeName, pidSnapShotSet, pidSnapShot)
    End Function
 
    Private Function ISHADOW_VSSInitializeForBackup() ' As ULong Implements ISHADOW.VSSInitializeForBackup
        Throw New NotImplementedException()
    End Function
 
    Private Function ISHADOW_VSSStartSnapshot(pwszVolumeName As String, ByRef pidSnapShotSet As Guid, ByRef pidSnapShot As Guid) 'As ULong Implements ISHADOW.VSSStartSnapshot
        Throw New NotImplementedException()
    End Function
 
    Private Function ISHADOW_VSSGetSnapShotDeviceName(ByRef bstrDeviceName As String, ByRef pidSnapShot As Guid) ' As ULong Implements ISHADOW.VSSGetSnapShotDeviceName
        Throw New NotImplementedException()
    End Function
 
    Private Function ISHADOW_VSSDeleteAllSnapshots(ByRef pidSnapShotSet As Guid) ' As ULong Implements ISHADOW.VSSDeleteAllSnapshots
        Throw New NotImplementedException()
    End Function
 
    Private Function ISHADOW_VSSCloseBackup() ' As ULong Implements ISHADOW.VSSCloseBackup
        Throw New NotImplementedException()
    End Function
End Class
Code de l'interface
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 
Public Interface ISHADOW
    Function Version() As Integer
    Function VSSInitializeForBackup() As System.UInt64
 
    Function VSSStartSnapshot(
                ByVal pwszVolumeName As String,
                ByRef pidSnapShotSet As Guid,
                ByRef pidSnapShot As Guid) As System.UInt64
 
    Function VSSGetSnapShotDeviceName _
                     (ByRef bstrDeviceName As String,
                      ByRef pidSnapShot As Guid) As System.UInt64
 
    Function VSSDeleteAllSnapshots _
                 (ByRef pidSnapShotSet As Guid) As System.UInt64
 
    Function VSSCloseBackup() As System.UInt64
End Interface
Pour info, j'utilise Visual Studio Community 2015

En vous remerciant d'avance à tous pour votre aide.

Cordialement.

JbOne