Page 1 of 1

How does PartCopy work ?

Posted: Tue Nov 16, 2010 2:19 am
by BenBowen
Before I end up screwing my computer, I want to know the benchmark of PartCopy's clockwork so that I can attempt to write a better version. I'm attempting to create my own Operating System (at least a simple one), but if I do, I want to know how most of my utilities work, and so forth.

So, could some one explain? Thanks in advanced,

Ben

Re: How does PartCopy work ?

Posted: Wed Nov 17, 2010 2:02 am
by Mike
Hello,

PartCopy provides a method of copying a region of a file or disk of a given size to another file or disk of that same size. The capability of copying over regions of files to another can be done with ISO C file routines. Reading and writing raw sectors on mounted devices must be done through the system API; the Win32 API WriteFile() routine seems to provide this. For Windows Vista and 7, in order to write raw sectors might require administrative rights.

Please note that this information is based on observation only; PartCopy isnt written by us although we can provide in-house source code for an example that does the above.

Re: How does PartCopy work ?

Posted: Wed Nov 17, 2010 4:35 am
by BenBowen
Pshh, I didn't know it was that simple! :)

Re: How does PartCopy work ?

Posted: Wed Nov 17, 2010 11:25 am
by Andyhhp
Pshh, I didn't know it was that simple! :)
A great many things are a lot more simple than they look.

The key to partcopy is that it doesnt open a normal file - it opens a file which represents the raw data on the disk (something like \\?\Disk\{GUID}\.. but I really dont know windows internal device paths very well)

This is along the same lines of writing to /dev/sdX in unix

At this point, the normal file operations like fread an fwrite work

~Andrew

Re: How does PartCopy work ?

Posted: Thu Nov 18, 2010 4:40 am
by BenBowen
Thanks. If I understand correctly, I would need to "find" the GUID for every user-chosen file path? Sorry, but I don't really know what I'm actually after; subjecting about these "GUIDs" and raw data.

EDIT:

And by the way... How do iostream and fstream work? ASM (assembly language)?

Re: How does PartCopy work ?

Posted: Thu Nov 18, 2010 8:38 am
by Andyhhp
No - the GUIDs are per device on the computer - but you really will need a windows reference to know how to use the device paths correctly.

As for iostream and fstream - they are little more than wrappers around the c stdio library in an object orientated fasion.

Re: How does PartCopy work ?

Posted: Thu Nov 18, 2010 3:40 pm
by BenBowen
Yes I regularly use MSDN. *checks MSDN* So could you give me an example, just so I can be certain?