I rewrote the answer based on a better understanding of the question, but without losing my original answer for those who find this question.
Getting size from code running on device
: P/Invoke GetDiskFreeSpaceEx ( ) , .
, , - , , .
P/Invoke. . . - :
public class MyClass
{
[DllImport("coredll.dll", SetLastError=true, CharSet=CharSet.Auto)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool GetDiskFreeSpaceEx(string lpDirectoryName,
out ulong lpFreeBytesAvailable,
out ulong lpTotalNumberOfBytes,
out ulong lpTotalNumberOfFreeBytes);
}
( , ):
ulong GetDiskSize(string volumeName)
{
ulong avail;
ulong total;
ulong totalfree;
MyClass.GetDiskFreeSpaceEx(volumeName, out avail, out total, out totalFree);
return total;
}
:
ulong diskSize = GetDiskSize("\\Storage Card");
,
"", . , . API- , P/Invoke, .
, ActiveSync (XP ) WMDC (Vista), Remote API RAPI. API CeGetStoreInformation, , .
RAPI , , , ( ) . , , RAPI.GetDeviceStoreInformation.