Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to create partition in flash and access flash in application?

278 views
Skip to first unread message

SmileAgain

unread,
Aug 10, 2006, 4:08:32 AM8/10/06
to

There are two questions I met:

1.I want to create two partition in flash. How to do ?

The flash is M-System's mDOC (DiskOnChip) G3.

2.I want to access flash directly in application. But I always failed, GOD
save me~~~~

I read the document downloaded from M-System’s site. It tells me to do like
the following steps:

1. In platform.reg :

[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\TrueFFS]

“Dll” = “TrueFFS.dll”

“Prefix” = “DSK”

“Order” = dword:1

“Ioctl” = dword:4

“FSD” = “FATFS.DLL”

“WindowBase” = dword:d0000

“DocBase10” = dword:d8000

“DeviceArrayIndex” = dword:0

"IClass"="{A4E7EDDA-E575-4252-9D6B-4195D48BB865}" ;CE.NET only

2.In application:

hDev= CreateFile(TEXT("DSK1:"),

GENERIC_READ|GENERIC_WRITE,

0,

NULL,

OPEN_EXISTING,

0,

NULL);

if(hDev ==INVALID_HANDLE_VALUE)

{

TRACE(TEXT("Binding DiskOnChip driver failed .error

%ld\n"),GetLastError());

hDev = NULL;

return 1;

}

//Calling GetInfo extended function

TRACE(TEXT("Calling GetInfo\n"));

// get DiskOnChip information

if(DeviceIoControl(hDev,

FL_IOCTL_GET_INFO,

NULL,

0,

&diskInfoOutput,

sizeof(flDiskInfoOutput),

&dwGarbage,

NULL));

But I always can not CreateFile successfully by this way.

Who can tell me what else should I do? Is there any wrong Parameter?

I’m depressed with it for several days. Please help me!!!


Vadim Yushprakh

unread,
Sep 1, 2006, 6:26:57 PM9/1/06
to
1) Creating partitions in flash:

Does your flash drive show up on you system when you boot? You can find the
store programmatically by using the FindFirstStore()/FindNextStore() API.
Then name of the store will be returned to you in the STOREINFO.szStoreName
struct that you pass to the Find API(). Once you have the name of the store
for your flash drive, you can do the following:

1) Get a handle to the store using the OpenStore() api, which takes the
name of the store as an argument
2) Call DismountStore() on the handle you get in step 1
3) Use FindFirstPartition/FindNextPartition() API to find any existing
partitions on the store, and delete them via DeletePartition()
4) Use GetStoreInfo() to find out the number of available sectors for
new partions (STOREINFO.snBiggestPartCreatable)
5) Create 1 or more partions using the CreatePartition() api. You will
need to re-query GetStoreInfo() every time you add a partition, to get the
number of sectors remaining for the next partition

2) Accessing flash directly.

Instead of using CreateFile(), try using the handle returned by the
OpenStore() API. Use that handle for your DeviceIoControl() calls.

Relevant API documentation:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcemain4/html/cmconStorageManagerFunctions.asp

--Vadim Yushprakh

"SmileAgain" <skywa...@163.com> wrote in message
news:elGMuQFv...@TK2MSFTNGP06.phx.gbl...

0 new messages