Reputation: 1287
I want to get the size of the phone drive. I'm using "Nokia-PC-Connectivity"., and with respect to File System API I found on CONADifinition function called CONA_Folder_Info but this function doens't support FreeSize and Total Size but there is CONA_Folder.Info2 and its instance support these variables.
But when I used CONA_Folder.Info2 as follows:
CONADefinitions.CONAPI_FOLDER_INFO2 FolderInfo;
int iResult = 0;// Allocate memory for buffer
IntPtr Buffer = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(CONADefinitions.CONAPI_FOLDER_INFO2)));
iResult = CONAFileSystem.CONAFindNextFolder(hFindHandle, Buffer);
while (iResult == PCCSErrors.CONA_OK )
{
FolderInfo = (CONADefinitions.CONAPI_FOLDER_INFO2)Marshal.PtrToStructure(Buffer, typeof(CONADefinitions.CONAPI_FOLDER_INFO2));
if (FolderInfo.pstrName[0].ToString() != "C" && level == 0)
{
}
I get this exception:
FatalExecutionEngineError was detected Message: The runtime has encountered a fatal error. The address of the error was at 0x7a0ba769, on thread 0x1278. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.
Note: I use the S60 software platform. Application language is C#.
For more explanations please ask me.
Upvotes: 4
Views: 424
Reputation: 1528
It is correct that you get the exception when you try and convert the data in the buffer to a different type of structure than was originally created by CONAFileSystem.CONAFindNextFolder.
You are trying to force a data structure of type CONADefinitions.CONAPI_FOLDER_INFO into a structure of type CONADefinitions.CONAPI_FOLDER_INFO2. They almost certainly have different lengths and so on so its extremely unlikely this method would ever work.
From experience with C++ development on the Symbian OS, the pattern Nokia are likely to be using here is one where they have subsequently developed a newer version of the API and so have created a newer version of the CONADefinitions.CONAPI_FOLDER_INFO structure (i.e. CONADefinitions.CONAPI_FOLDER_INFO2).
Assuming this is correct there are 3 likelihoods:
1) There is an enum parameter to the first function which specifies which version of the output structure is to be created.
2) There is a new function which returns the new structure e.g. CONAFileSystem.CONAFindFirstFolder2, CONAFileSystem.CONAFindNextFolder2
3) Nokia have developed the new version internally but not yet released it publicly.
Upvotes: 1
Reputation: 67178
I don't know anything about the Nokia API, but in general I see the following:
Upvotes: 0