Crash on X64 :(

Dec 12, 2011 at 12:07 AM

Hello

I've a problem with X64 platform.

->Visual 2010

-> dotnet 4.0

->VSS work fine on windows XP 32 bits (my dev plateform)

-> Crash on windows 7 x64, (not dev platform, but framework 4 is installed, Package redistribuable Microsoft Visual C++ 2010 (x86) and Package redistribuable Microsoft Visual C++ 2010 (x64) are installed)  (he want to use AlphaVSS.60.x86.dll, normal?)

Program is compil with "any cpu"

my code:

using System.IO;

using Alphaleonis.Win32.Vss;

[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
        private static extern bool CopyFileEx(string lpExistingFileName, string lpNewFileName, CopyProgressRoutine lpProgressRoutine, int lpData, ref int pbCancel, uint dwCopyFlags);
        private delegate uint CopyProgressRoutine(long TotalFileSize, long TotalBytesTransferred, long StreamSize, long StreamBytesTransferred, uint dwStreamNumber, uint dwCallbackReason, IntPtr hSourceFile, IntPtr hDestinationFile, IntPtr lpData);


  public static void CopyFile(string source, string destination)
        {

// try // { var oVSSImpl = VssUtils.LoadImplementation(); using (var vss = oVSSImpl.CreateVssBackupComponents()) { vss.InitializeForBackup(null); vss.SetBackupState(false, true, VssBackupType.Full, false); using (var async = vss.GatherWriterMetadata()) async.Wait(); vss.StartSnapshotSet(); string volume = new FileInfo(source).Directory.Root.Name; var snapshot = vss.AddToSnapshotSet(volume, Guid.Empty); using (var async = vss.PrepareForBackup()) async.Wait(); using (var async = vss.DoSnapshotSet()) async.Wait(); var props = vss.GetSnapshotProperties(snapshot); string vssFile = source.Replace(volume, props.SnapshotDeviceObject + @"\"); int cancel = 0; CopyFileEx(vssFile, destination, null, 0, ref cancel, 0); } // } // catch // { // } }

Have you an idea to help me ?

 

thanks

Coordinator
Feb 6, 2012 at 7:06 PM

Seems strange that it is the x86 binary that gets loaded since this will likely not work on an X64 platform. Is there anything that you can think of that makes your application run as a 32-bit app?


// Decaf