Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Openstore安装存储设备 我对C++非常陌生,希望有人能在安装存储卡时填写空白。我正在尝试在windows mobile下安装存储卡。OpenStore可能正在工作,因为我没有收到错误,但我仍在尝试找出OpenPartition、MountPartition和GetStoreInfo的语法。如果有人能给我举个例子,那真的很有帮助_C++_Windows_Windows Mobile_Windows Ce - Fatal编程技术网

使用Openstore安装存储设备 我对C++非常陌生,希望有人能在安装存储卡时填写空白。我正在尝试在windows mobile下安装存储卡。OpenStore可能正在工作,因为我没有收到错误,但我仍在尝试找出OpenPartition、MountPartition和GetStoreInfo的语法。如果有人能给我举个例子,那真的很有帮助

使用Openstore安装存储设备 我对C++非常陌生,希望有人能在安装存储卡时填写空白。我正在尝试在windows mobile下安装存储卡。OpenStore可能正在工作,因为我没有收到错误,但我仍在尝试找出OpenPartition、MountPartition和GetStoreInfo的语法。如果有人能给我举个例子,那真的很有帮助,c++,windows,windows-mobile,windows-ce,C++,Windows,Windows Mobile,Windows Ce,这就是我到目前为止所做的: #include "stdafx.h" #include <storemgr.h> #include <stdio.h> int _tmain( int /*argc*/, _TCHAR* /*argv*/[] ) { STOREINFO si = { 0 }; si.cbSize = sizeof( STOREINFO ); HANDLE hDsk; HANDLE Findpart; BOOL suc

这就是我到目前为止所做的:

#include "stdafx.h"
#include <storemgr.h>
#include <stdio.h>

int _tmain( int /*argc*/, _TCHAR* /*argv*/[] )
{
    STOREINFO si = { 0 };
    si.cbSize = sizeof( STOREINFO );
    HANDLE hDsk;
    HANDLE Findpart;
    BOOL success = FALSE;
    DWORD Count = 600;
    WCHAR szDisk[] = L"DSK2:";

    hDsk = OpenStore(szDisk);

    HANDLE hPartition = OpenPartition(hDsk, TEXT("Part00"));

    MountPartition(hPartition);

    if(hDsk == INVALID_HANDLE_VALUE) 
        printf("Error opening store");

    if (!GetStoreInfo(hDsk, &si))
        printf("Error getting info");

    if(!DismountStore(hDsk)) 
        printf("Error Dismounting");

    if(!FormatStore(hDsk)) 
        printf("Error Formatting");

    CloseHandle(hDsk);
}
#包括“stdafx.h”
#包括
#包括
int _tmain(int/*argc*/,_TCHAR*/*argv*/[]))
{
STOREINFO si={0};
si.cbSize=sizeof(STOREINFO);
处理hDsk;
处理Findpart;
布尔成功=假;
德沃德计数=600;
WCHAR szDisk[]=L“DSK2:”;
hDsk=OpenStore(szDisk);
HANDLE hppartition=OpenPartition(hDsk,TEXT(“Part00”);
安装分区(HPPartition);
if(hDsk==无效的句柄值)
printf(“错误打开存储”);
如果(!GetStoreInfo(hDsk和si))
printf(“获取信息时出错”);
如果(!卸载存储(hDsk))
printf(“错误卸载”);
如果(!格式化存储(hDsk))
printf(“错误格式”);
闭合手柄(hDsk);
}

这里是一些快速测试项目的摘录。希望有帮助

   HANDLE hStore, hPartSearch, hPart;
   STOREINFO StoreInfo;
   PARTINFO PartInfo[3];
   DWORD error;
   BOOL bRes;

   hStore = OpenStore(L"DSK1:");

   if (hStore == INVALID_HANDLE_VALUE)
      return;

   memset (&StoreInfo, 0, sizeof (StoreInfo));
   StoreInfo.cbSize = sizeof(STOREINFO);
   if (!GetStoreInfo(hStore, &StoreInfo))
   {
      error = GetLastError();
   }

   // 1st part
   PartInfo[0].cbSize = sizeof(PartInfo[0]);
   hPartSearch = FindFirstPartition(hStore, &PartInfo[0]);
   // 2nd part
   PartInfo[1].cbSize = sizeof(PartInfo[1]);
   FindNextPartition(hPartSearch,&PartInfo[1]);


   // Format and remount boot partition
   hPart = OpenPartition(hStore, PartInfo[0].szPartitionName);
   bRes = DismountPartition(hPart);
   error = GetLastError();
   bRes = FormatPartition(hPart);
   error = GetLastError();
   bRes = MountPartition(hPart);
   error = GetLastError();
谢谢timmf

#include "stdafx.h"
#include <storemgr.h>
#include <stdio.h>

int _tmain( int /*argc*/, _TCHAR* /*argv*/[] )
{

 STOREINFO si = { 0 };
    si.cbSize = sizeof( STOREINFO );




 HANDLE hStore, hPartSearch, hPart;
   STOREINFO StoreInfo;
   PARTINFO PartInfo[3];
   DWORD error;
   BOOL bRes;

   hStore = OpenStore(L"DSK2:");

   if (hStore == INVALID_HANDLE_VALUE)
   {
 printf("Error opening store");
   }

   memset (&StoreInfo, 0, sizeof (StoreInfo));
   StoreInfo.cbSize = sizeof(STOREINFO);
   if (!GetStoreInfo(hStore, &StoreInfo))
   {
      error = GetLastError();
   }

   // 1st part
   PartInfo[0].cbSize = sizeof(PartInfo[0]);
   hPartSearch = FindFirstPartition(hStore, &PartInfo[0]);
   // 2nd part
   PartInfo[1].cbSize = sizeof(PartInfo[1]);
   FindNextPartition(hPartSearch,&PartInfo[1]);


   // Format and remount boot partition
   hPart = OpenPartition(hStore, PartInfo[0].szPartitionName);
   bRes = DismountPartition(hPart);
   error = GetLastError();
   bRes = FormatPartition(hPart);
   error = GetLastError();
   bRes = MountPartition(hPart);
   error = GetLastError();
}
#包括“stdafx.h”
#包括
#包括
int _tmain(int/*argc*/,_TCHAR*/*argv*/[]))
{
STOREINFO si={0};
si.cbSize=sizeof(STOREINFO);
处理hStore、hPartSearch、hPart;
STOREINFO STOREINFO;
PARTINFO PARTINFO[3];
德沃德误差;
布尔布雷斯;
hStore=OpenStore(L“DSK2:”);
if(hStore==无效的句柄值)
{
printf(“错误打开存储”);
}
memset(&StoreInfo,0,sizeof(StoreInfo));
StoreInfo.cbSize=sizeof(StoreInfo);
如果(!GetStoreInfo(hStore和StoreInfo))
{
error=GetLastError();
}
//第一部分
PartInfo[0].cbSize=sizeof(PartInfo[0]);
hPartSearch=FindFirstPartition(hStore,&PartInfo[0]);
//第二部分
PartInfo[1].cbSize=sizeof(PartInfo[1]);
FindNextPartition(hPartSearch和PartInfo[1]);
//格式化并重新安装引导分区
hPart=OpenPartition(hStore,PartInfo[0].szPartitionName);
bRes=可拆卸分区(hPart);
error=GetLastError();
bRes=格式化分区(hPart);
error=GetLastError();
bRes=安装分区(hPart);
error=GetLastError();
}

非常感谢。。效果很好