Bona Fide OS Development
http://forums.osdever.net/

partcopy
http://forums.osdever.net/viewtopic.php?f=15&t=159
Page 1 of 1

Author:  Michael [ Tue Feb 09, 2010 5:02 am ]
Post subject:  partcopy

Anyone know if a partcopy is available for Windows x64?

Author:  Kieran [ Tue Feb 09, 2010 6:05 am ]
Post subject:  Re: partcopy

I dont know mate, But I do know that the source code is out there...

Author:  Michael [ Fri Feb 12, 2010 4:45 am ]
Post subject:  Re: partcopy

I have found the solution:

http://sourceforge.net/projects/mingw/f ... z/download

Author:  Kieran [ Sun Feb 14, 2010 1:25 pm ]
Post subject:  Re: partcopy

Cool mate. I knew it would be out there :P

Author:  dumb_terminal [ Wed Dec 29, 2010 11:57 am ]
Post subject:  Re: partcopy

I think the following piece of code does the 'write sector 0' part of the partcopy
Code:
/*
    FileName: bootsectorwrite.cpp
    Author: dumb_terminal
    usage: <program> <drive letter> <bootloader file>
*/
#include <stdio.h>
#include <string.h>
#include <windows.h>

#pragma comment (lib, "LIBCD.lib")

int main(int argc, char *argv[]){
    char drvPath[255] = "" ;
    char bootFile[255] = "" ;

    char buffer[512] ;

    DWORD szRead, szWrite ;

    if (argc != 3){
        printf("Usage BootSectorWrite <DriveLetterUCase> <BinaryBootImage>\n") ;
        return 0 ;
    }

    strcpy(bootFile, argv[2]) ;
    sprintf(drvPath, "\\\\.\\%c:", argv[1][0]) ;
    HANDLE hFile = CreateFile(bootFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL) ;
    HANDLE hDrv = CreateFile(drvPath, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, NULL, NULL) ;

    if (hFile == INVALID_HANDLE_VALUE || hDrv == INVALID_HANDLE_VALUE){
        printf("Error occured\n") ;
        return 0 ;
    }
   
    ReadFile(hFile, &buffer[0], 512, &szRead, NULL) ;
    WriteFile(hDrv, &buffer[0], szRead, &szWrite, NULL) ;

    CloseHandle(hFile) ;
    CloseHandle(hDrv) ;

    return 0 ;
}

well tried to be helpful.

Page 1 of 1 All times are UTC - 6 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/