Diskpart clone started

All development related issues welcome

Moderator: Moderator Team

Post Reply
milawynsrealm
Posts: 43
Joined: Wed Jul 20, 2011 10:48 pm

Diskpart clone started

Post by milawynsrealm »

I have started on a clone of the DiskPart utility. Even though the utility isn't needed right now as part of the project, I mostly started the project mostly out of curiosity and consistently updated the code ever since. I know nothing about any partition/disk/volume/vdisk specific code, as I am currently focusing on the interactive bits right now.


What I've Done So Far:
--------------------------
1) Interpreter code is able to input commands. It first takes the first word and from a list, it determines which command is used, and then runs the proper command with the arguments of the command as one string.

2) The help code is a work in progress. Right now, the help text is taken right from the diskpart utility as I am still learning about the details about the tool itself. Help code and most of the text is taken from a win32 stringtable to allow multiple language support.

3) When running a script from the command line (\s), it will properly take the commands and process them the same way.


As for the rest of the code, it's just a matter of working on the command functions themselves after finishing the command framework (active.c, add.c, assign.c, etc.).


What todo before I release any code:
---------------------------------------------
1) Finish command function framework
2) Finish the first layer of the help system
vicmarcal
Test Team
Posts: 2733
Joined: Mon Jul 07, 2008 12:35 pm

Re: Diskpart clone started

Post by vicmarcal »

milawynsrealm wrote:I have started on a clone of the DiskPart utility. Even though the utility isn't needed right now as part of the project, I mostly started the project mostly out of curiosity and consistently updated the code ever since. I know nothing about any partition/disk/volume/vdisk specific code, as I am currently focusing on the interactive bits right now.


What I've Done So Far:
--------------------------
1) Interpreter code is able to input commands. It first takes the first word and from a list, it determines which command is used, and then runs the proper command with the arguments of the command as one string.

2) The help code is a work in progress. Right now, the help text is taken right from the diskpart utility as I am still learning about the details about the tool itself. Help code and most of the text is taken from a win32 stringtable to allow multiple language support.

3) When running a script from the command line (\s), it will properly take the commands and process them the same way.


As for the rest of the code, it's just a matter of working on the command functions themselves after finishing the command framework (active.c, add.c, assign.c, etc.).


What todo before I release any code:
---------------------------------------------
1) Finish command function framework
2) Finish the first layer of the help system
Hi!
:) I am sure you will learn a lot through the study of the App.
But let me help/guide you a little:
1)We currently have a "Console" (cmd.exe) in our repository, maybe you can use it as basis for your "framework". You can delete all the commands in our console, or even more, add your new ones to the current ones. You will learn a lot looking Cmd.exe code as it is WinAPI and the best way to do ReactOS apps.
2)Avoid Win32 stringtables. Currently we are using .RC files. Search in Google about .rc files usage, or look how we add multilingual support in CMD.exe thanks to the .rc files.

Of course, you can follow your own way :)
milawynsrealm
Posts: 43
Joined: Wed Jul 20, 2011 10:48 pm

Re: Diskpart clone started

Post by milawynsrealm »

When I talked about a framework, I meant using a separate source file for each command (eg. automount.c; automount.h). This helps reduce complexity in code and make updating code easier. Sorry about the confusion.

As for stringtables, I am using RC files. In the RC file, it is laid out like so:

Code: Select all

//Convert help description
STRINGTABLE DISCARDABLE
BEGIN
    IDS_HELP_CMD_CONVERT_BASIC      "Convert a disk from dynamic to basic."
    IDS_HELP_CMD_CONVERT_DYNAMIC    "Convert a disk from basic to dynamic."
    IDS_HELP_CMD_CONVERT_GPT        "Convert a disk from MBR to GPT."
    IDS_HELP_CMD_CONVERT_MBR        "Convert a disk from GPT to MBR."
END
Is it the same. I looked at the RC code for cmd.exe and saw the same use of stringtable. Let me know if I'm wrong.
vicmarcal
Test Team
Posts: 2733
Joined: Mon Jul 07, 2008 12:35 pm

Re: Diskpart clone started

Post by vicmarcal »

milawynsrealm wrote: As for stringtables, I am using RC files. In the RC file, it is laid out like so:
I looked at the RC code for cmd.exe and saw the same use of stringtable. Let me know if I'm wrong.
Sure, that is the way I suggested..dunno why I thought about other "ugly" methods when you said Stringtables :). My fault, sorry.
Our CMD.exe is able to run external commands as the ftp.exe command which is invoked through it, so you can create those commands as different .exeS and use Console as a framework to launch them. I have recommended CMD because it could help us to integrate your code, but as CMD can invoke external commands too, then NP.
Our current CMD.exe is coded more or less in he way you suggested:There are several files that controls the "framework" and then each command has its own *.c file as: move.c , copy.c , etc.
milawynsrealm
Posts: 43
Joined: Wed Jul 20, 2011 10:48 pm

Re: Diskpart clone started

Post by milawynsrealm »

What do you mean by integrating my code? The original intent of the diskpart utility clone was to make it a separate program that would run from the WINDOWS/System32 folder, which would then be loadable from the CMD program interface. The utility has the ability to take scripts in the command-line argument and process it, and simply running the program will bring up a input window to type in commands. And since the program deals with "focusing" on certain disks/partitions/filesystems/etc., I don't think that having the commands as separate programs would be a good idea. Once the "command" program closes, the focus is lost and the user would have to refocus the selected drive again, effectively making the program into something else entirely.

Personally, I would think that having all the diskpart commands under 1 program would be a better idea at this time. For example, the focus would stay the same from command to command. When you say "external commands," do you mean as separate programs?
gabrielilardi
Moderator Team
Posts: 873
Joined: Sat Sep 02, 2006 1:30 am
Location: Italy

Re: Diskpart clone started

Post by gabrielilardi »

milawynsrealm wrote:The original intent of the diskpart utility clone was to make it a separate program that would run from the WINDOWS/System32 folder, which would then be loadable from the CMD program interface.
Yeah, that's exactly what diskpart should be.
Personally, I would think that having all the diskpart commands under 1 program would be a better idea at this time. For example, the focus would stay the same from command to command. When you say "external commands," do you mean as separate programs?
All the commands you run in diskpart are inside of diskpart.exe afaik, the clone should be like the original.
milawynsrealm
Posts: 43
Joined: Wed Jul 20, 2011 10:48 pm

Re: Diskpart clone started

Post by milawynsrealm »

Before this topic becomes inactive, I want to know one thing: how would I go about releasing my code once I've gotten what I need to get done, finished? Even though I started this project for personal education purposes, I have no present intent to finish the actual program to a usable state. I just want to get the bare bones basics finished and then let someone else later on down the line pick up where I've left off. Even if I knew the proper APIs to use to make the actual program work, I still won't do it. I have several reasons why I'm doing this:

[*] This was supposed to be a small project in order to educate myself on how to create an interactive program that took and processed commands from the user. After working on the project for a while, I realized that if I were to finish the project, I would take a lot of time from learning. And I have a LOT of learning to do.
[*] I have several ideas on future projects (many of them small programs), and dedicating myself solely to the diskpart utility would hamper the progress of them.
[*] I have college coming soon with a full workload in late August. I want to be able to focus more on my schoolwork.
gabrielilardi
Moderator Team
Posts: 873
Joined: Sat Sep 02, 2006 1:30 am
Location: Italy

Re: Diskpart clone started

Post by gabrielilardi »

milawynsrealm wrote:how would I go about releasing my code once I've gotten what I need to get done, finished? Even though I started this project for personal education purposes, I have no present intent to finish the actual program to a usable state.
You can file a bug report in bugzilla attaching your source and license (GPL would be advisable). You'd better compile it using RosBE to make sure it builds ok. Regarding your goals, it's a pitty, as leaving it half the way will probably mean it will bitrot like that unless someone else has the time/will to finish it, and I doubt this will happen any time soon.
milawynsrealm
Posts: 43
Joined: Wed Jul 20, 2011 10:48 pm

Re: Diskpart clone started

Post by milawynsrealm »

Actually, I won't completely abandon the project. Just put it on hiatus for right now as I have other matters to deal with. I also need the time in order to do research on the functionality needed to make the program work if I want to do this correctly.
milawynsrealm
Posts: 43
Joined: Wed Jul 20, 2011 10:48 pm

Re: Diskpart clone started

Post by milawynsrealm »

I've built the program successfully against the latest version of SVN, but now I have a new problem. The program compiles correctly, but when I type in the "make bootcd" command, it doesn't package with the ISO image. Is there something else I should be doing? I've already set up BOTH the rbuild and the cmake files needed for building, but I don't know what to do next.
gabrielilardi
Moderator Team
Posts: 873
Joined: Sat Sep 02, 2006 1:30 am
Location: Italy

Re: Diskpart clone started

Post by gabrielilardi »

milawynsrealm wrote:...it doesn't package with the ISO image. Is there something else I should be doing?
Yeah, add it to the cd editing reactos.dff, see this link in the wiki.
milawynsrealm
Posts: 43
Joined: Wed Jul 20, 2011 10:48 pm

Re: Diskpart clone started

Post by milawynsrealm »

Thanks. I've got it now.
milawynsrealm
Posts: 43
Joined: Wed Jul 20, 2011 10:48 pm

Re: Diskpart clone started

Post by milawynsrealm »

I know it's been a while since I have posted to this topic, but I have decided to simply restart the effort of writing the diskpart utility. I am doing this for the following reasons:

* When I first started the project, I really had no idea what I was doing. For most of the development of the diskpart utility so far, I was simply guessing at how it was supposed to work and it wasn't until other developers patched what I had until I got a better idea on how to make it better.
* Also when I first started diskpart, my only other experience with programming was with command-line and using SDL to make simple games. I had no idea that the project involved the Windows SDK until I was actually working on the project.
* For some odd reason, the interpreter code now runs on an endless loop. When you type in the help command, the interpreter somehow loops endlessly, no matter what else you type in.
* I am a bit more experienced with writing code than I was when I started the diskpart utility.

Right now, I am rewriting the core pieces, and filling the other pieces as I find free time to do them since I am in college right now. I am also more willing to actually implement the actual code for managing disk partitions. But in order for that to happen, it would take time, effort, and research before I even begin. So for now, I will be working on the core pieces to make sure that it works properly and doing the proper research to bring it from a skeleton program that doesn't do anything to something that is useful for the project.
BrentNewland
Posts: 176
Joined: Wed Oct 05, 2011 7:32 am

Re: Diskpart clone started

Post by BrentNewland »

Sounds good. I see there's a diskpart.exe in the ReactOS install disc, I assume that's the one you wrote?
milawynsrealm
Posts: 43
Joined: Wed Jul 20, 2011 10:48 pm

Re: Diskpart clone started

Post by milawynsrealm »

Yes. It's just a matter of finding time to actually work on it.
Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests