Recovery Module.exe中0x7737e73e的未处理异常:0xC0000005:访问冲突写入位置0x00001012. [英] Unhandled exception at 0x7737e73e in Recovery Module.exe: 0xC0000005: Access violation writing location 0x00001012.

查看:103
本文介绍了Recovery Module.exe中0x7737e73e的未处理异常:0xC0000005:访问冲突写入位置0x00001012.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

//#include< stdafx.h>
#include< stdio.h>
#include< conio.h>

#include< windows.h>
#include< shobjidl.h>
#include< ole2.h>
#include< objidl.h>
#define BUFFERSIZE 1024

EXTERN_C void wmain()
{
HRESULT hr;
IStorage * pStg;
IStorage * pStg1;
IStorage * pStg2;
WCHAR * pwszError = L";

IStream * pSt = NULL;



hr = StgOpenStorageEx(L"E:\\ Root.stg",
STGM_READ | STGM_SHARE_DENY_WRITE,
STGFMT_DOCFILE,
0,NULL,0,
IID_IPropertySetStorage,
reinterpret_cast< void **>(& pStg));
if(hr == S_OK)
printf(存储已打开");

hr = pStg-> OpenStream(L"Rodies.mp3",NULL,STGM_DIRECT | STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE,0,(void **)& pStg);
if(hr == S_OK)
printf(流已打开");
其他
printf(未打开");

_getch();


}

//#include <stdafx.h>
#include <stdio.h>
#include<conio.h>

#include <windows.h>
#include<shobjidl.h>
#include <ole2.h>
#include<objidl.h>
#define BUFFERSIZE 1024

EXTERN_C void wmain()
{
HRESULT hr ;
IStorage *pStg;
IStorage* pStg1;
IStorage *pStg2;
WCHAR *pwszError = L"";

IStream *pSt=NULL;



hr = StgOpenStorageEx( L"E:\\Root.stg",
STGM_READ|STGM_SHARE_DENY_WRITE,
STGFMT_DOCFILE,
0, NULL, 0,
IID_IPropertySetStorage,
reinterpret_cast<void**>(&pStg) );
if(hr==S_OK)
printf("Storage opened");

hr=pStg->OpenStream(L"Rodies.mp3",NULL,STGM_DIRECT | STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE,0,(void**)&pStg);
if(hr==S_OK)
printf("Stream opened");
else
printf("Not Opened");

_getch();


}

推荐答案

*不要忘记REFIID对应于您想要的接口:
IID_IPropertySetStorage想要IPropertySetStorage *
IID_IStorage想要IStorage *
*使用后不要忘记释放接口.
*不要忘记仅在返回值(HRESULT)== S_OK的情况下使用使用接口.
看起来更好:
* Dont forget that the REFIID corresponds to the interface you want:
IID_IPropertySetStorage wants IPropertySetStorage*
IID_IStorage wants IStorage*
* Dont forget to release interfaces after usage.
* Dont forget use interfaces only valid if the return value (HRESULT) == S_OK.
This looks better:
IStorage*    pStorage;
IStream*    pStream;
HRESULT      hr;

hr = StgOpenStorageEx
      (
        L"E:\\Root.stg",
        STGM_READ|STGM_SHARE_DENY_WRITE,
        STGFMT_DOCFILE,
        0, NULL, 0,
        IID_IStorage,
        (void**)&pStorage
      );

if(S_OK==hr)
{
  printf("Storage opened");

  if(S_OK==pStorage->OpenStream(L"Rodies.mp3",NULL,STGM_DIRECT | STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE,0,(void**)&pStream))
  {
    printf("Stream opened");
    pStream->Release();
  }
  else
  {
    printf("Not Opened");
  }
  pStorage->Release();
}

_getch();


祝您好运.


Good luck.


其原因在于IStorage不是有效的对象.您可以向我们展示初始化OpenStream
its becuase IStorage is not a valid object. can you show us the initialization OpenStream


这篇关于Recovery Module.exe中0x7737e73e的未处理异常:0xC0000005:访问冲突写入位置0x00001012.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆