 |
|
 |
the source code is simply incomplete. WTF???
|
|
|
|
 |
|
 |
It's called like ((ITStorage)Obj).StgOpenStorage(workPath, IntPtr.Zero, 32, IntPtr.Zero, 0)
If the workPath contains unicode string like "Ěščasdf", this method will throw exception.
Does anyone know how to fix it.
Best Regards,
Kevin
|
|
|
|
 |
|
 |
namespace RelatedObjects.Storage { public enum ECompactionLev { COMPACT_DATA, COMPACT_DATA_AND_PATH } public class IBaseStorageWrapper { public IBaseStorageWrapper(); protected void EnumIStorageObject(IStorage stgArgument); protected void EnumIStorageObject(IStorage stgArgument, string BasePath); public static string BaseUrl { get; set; } private static string baseUrl; public FileObjects foCollection; protected IStorage storage;
public class FileObjects : CollectionBase { public FileObjects(); public void Add(FileObject fo); public FileObject Item(int index); public void Remove(int index);
public class FileObject : Stream { public FileObject(); public override void Close(); public override void Flush(); public override int Read(byte[] buffer, int offset, int count); public string ReadFromFile(); public void Save(string FileName); public override long Seek(long offset, SeekOrigin origin); public override void SetLength(long Value); public override void Write(byte[] buffer, int offset, int count); public override bool CanRead { get; } public override bool CanSeek { get; } public override bool CanWrite { get; } public string FileName { get; set; } public string FilePath { get; set; } public IStorage FileStorage { get; set; } public UCOMIStream FileStream { get; set; } public int FileType { get; set; } public string FileUrl { get; set; } public override long Length { get; } public override long Position { get; set; } private string fileName; private string filePath; private IStorage fileStorage; private UCOMIStream fileStream; private int fileType; private string fileUrl; } } } [ComImport, Guid("0000000D-0000-0000-C000-000000000046"), SuppressUnmanagedCodeSecurity, InterfaceType(1)] public interface IEnumSTATSTG { [PreserveSig] int Next(int celt, [Out] out STATSTG rgVar, [Out] out int pceltFetched); [PreserveSig] int Skip(int celt); [PreserveSig] int Reset(); int Clone([Out] out IEnumSTATSTG newEnum); } [ComImport, Guid("0000000a-0000-0000-C000-000000000046"), InterfaceType(1)] public interface ILockBytes { int ReadAt(long ulOffset, [Out] out IntPtr pv, int cb); int WriteAt(long ulOffset, IntPtr pv, int cb); void Flush(); void SetSize(long cb); void LockRegion(long libOffset, long cb, int dwLockType); void UnlockRegion(long libOffset, long cb, int dwLockType); void Stat(ref STATSTG pstatstg, int grfStatFlag); } [ComImport, SuppressUnmanagedCodeSecurity, Guid("0000000B-0000-0000-C000-000000000046"), InterfaceType(1)] public interface IStorage { [return: MarshalAs(UnmanagedType.Interface)] UCOMIStream CreateStream([In, MarshalAs(UnmanagedType.BStr)] string pwcsName, [In, MarshalAs(UnmanagedType.U4)] int grfMode, [In, MarshalAs(UnmanagedType.U4)] int reserved1, [In, MarshalAs(UnmanagedType.U4)] int reserved2); [return: MarshalAs(UnmanagedType.Interface)] UCOMIStream OpenStream([In, MarshalAs(UnmanagedType.BStr)] string pwcsName, IntPtr reserved1, [In, MarshalAs(UnmanagedType.U4)] int grfMode, [In, MarshalAs(UnmanagedType.U4)] int reserved2); [return: MarshalAs(UnmanagedType.Interface)] IStorage CreateStorage([In, MarshalAs(UnmanagedType.BStr)] string pwcsName, [In, MarshalAs(UnmanagedType.U4)] int grfMode, [In, MarshalAs(UnmanagedType.U4)] int reserved1, [In, MarshalAs(UnmanagedType.U4)] int reserved2); [return: MarshalAs(UnmanagedType.Interface)] IStorage OpenStorage([In, MarshalAs(UnmanagedType.BStr)] string pwcsName, IntPtr pstgPriority, [In, MarshalAs(UnmanagedType.U4)] int grfMode, IntPtr snbExclude, [In, MarshalAs(UnmanagedType.U4)] int reserved); void CopyTo(int ciidExclude, [In, MarshalAs(UnmanagedType.LPArray)] Guid[] rgiidExclude, IntPtr snbExclude, [In, MarshalAs(UnmanagedType.Interface)] IStorage pstgDest); void MoveElementTo([In, MarshalAs(UnmanagedType.BStr)] string pwcsName, [In, MarshalAs(UnmanagedType.Interface)] IStorage pstgDest, [In, MarshalAs(UnmanagedType.BStr)] string pwcsNewName, [In, MarshalAs(UnmanagedType.U4)] int grfFlags); void Commit(int grfCommitFlags); void Revert(); int EnumElements([In, MarshalAs(UnmanagedType.U4)] int reserved1, IntPtr reserved2, [In, MarshalAs(UnmanagedType.U4)] int reserved3, [Out, MarshalAs(UnmanagedType.Interface)] out IEnumSTATSTG ppenum); void DestroyElement([In, MarshalAs(UnmanagedType.BStr)] string pwcsName); void RenameElement([In, MarshalAs(UnmanagedType.BStr)] string pwcsOldName, [In, MarshalAs(UnmanagedType.BStr)] string pwcsNewName); void SetElementTimes([In, MarshalAs(UnmanagedType.BStr)] string pwcsName, [In] FILETIME pctime, [In] FILETIME patime, [In] FILETIME pmtime); void SetClass(ref Guid clsid); void SetStateBits(int grfStateBits, int grfMask); int Stat([Out] out STATSTG pStatStg, int grfStatFlag); } public class IStorageWrapper : IBaseStorageWrapper { public IStorageWrapper(string workPath); } [StructLayout(LayoutKind.Sequential)] public struct ITS_Control_Data { private int cdwControlData; private int adwControlData; } [ComImport, SuppressUnmanagedCodeSecurity, InterfaceType(1), Guid("88CC31DE-27AB-11D0-9DF9-00A0C922E6EC")] public interface ITStorage { [return: MarshalAs(UnmanagedType.Interface)] IStorage StgCreateDocfile([In, MarshalAs(UnmanagedType.BStr)] string pwcsName, int grfMode, int reserved); [return: MarshalAs(UnmanagedType.Interface)] IStorage StgCreateDocfileOnILockBytes(ILockBytes plkbyt, int grfMode, int reserved); int StgIsStorageFile([In, MarshalAs(UnmanagedType.BStr)] string pwcsName); int StgIsStorageILockBytes(ILockBytes plkbyt); [return: MarshalAs(UnmanagedType.Interface)] IStorage StgOpenStorage([In, MarshalAs(UnmanagedType.BStr)] string pwcsName, IntPtr pstgPriority, [In, MarshalAs(UnmanagedType.U4)] int grfMode, IntPtr snbExclude, [In, MarshalAs(UnmanagedType.U4)] int reserved); [return: MarshalAs(UnmanagedType.Interface)] IStorage StgOpenStorageOnILockBytes(ILockBytes plkbyt, IStorage pStgPriority, int grfMode, IntPtr snbExclude, int reserved); int StgSetTimes([In, MarshalAs(UnmanagedType.BStr)] string lpszName, FILETIME pctime, FILETIME patime, FILETIME pmtime); int SetControlData(ITS_Control_Data pControlData); int DefaultControlData(ITS_Control_Data ppControlData); int Compact([In, MarshalAs(UnmanagedType.BStr)] string pwcsName, ECompactionLev iLev); } public class ITStorageWrapper : IBaseStorageWrapper { public ITStorageWrapper(string workPath); private UCOMITStorage comITStorage; private ITStorage comITStorageInterfaced; } public class Ole32 { public Ole32(); [DllImport("Ole32.dll")] public static extern int StgOpenStorage([MarshalAs(UnmanagedType.LPWStr)] string wcsName, IStorage pstgPriority, int grfMode, IntPtr snbExclude, int reserved, [Out] out IStorage storage); } public enum StgErrors : uint { S_OK = 0, STG_E_FILENOTFOUND = 0x80030002, STG_E_INVALIDNAME = 0x800300fc } public enum StgType { STGTY_LOCKBYTES = 3, STGTY_PROPERTY = 4, STGTY_STORAGE = 1, STGTY_STREAM = 2 } [ComImport, Guid("5D02926A-212E-11D0-9DF9-00A0C922E6EC")] public class UCOMITStorage { } public enum WinErrors { S_OK } } Tom Clement Serena Software, Inc. www.serena.com articles[^]
|
|
|
|
 |
|
 |
You said:
// FileUrl - is an external reference
//to the internal object. It allows you to display content
//of a single file in Internet Explorer
// without extracting content from the archive
and I'm trying to do that and IE opens a page with this url: mk:@MSITStore:help-en.chm:://Item%202.2.html
but i don't see the content
What should I do?
-- modified at 3:26 Monday 24th July, 2006
|
|
|
|
 |
|
 |
Give the full path to your CHM file.
|
|
|
|
 |
|
 |
Hey does anyone know of a HLP decompiler.
Is there anyway to amend the CHM decompiler to decompile HLP files.
Thank you.
|
|
|
|
 |
|
 |
1. in vs2003,first you build up a c++ project
2. choose ATL
3. insert simple atl object
4. insert "IStorage pStg;" delare
5. build typelib and tlbexp it
6. add reference to c# project
7. you will see IStorage,IStream ,FILETIME interface and so on. they are available.
if you have question,please tell me.
thanks
|
|
|
|
 |
|
 |
Could you please elaborate on step 4 (insert "IStorage pStg;"). Where do you insert this declaration?
|
|
|
|
 |
|
 |
of course.if you create a atl project named atl_a.There is a default class named atl_class_a. You can declare "IStorage *pStg;" to atl_class_a.h file.
ok ,I have post this program to mail you,You may have a look.;P
|
|
|
|
 |
|
 |
Thank you very much for your help and expertise! I never thought it was that simple...
|
|
|
|
 |
|
 |
Hello,
Is it possible to have your source code sample ?
Thanks a lots
Vincent.
|
|
|
|
 |
|
 |
please give me your avail e-mail
please to check your e-mail available, whether or not hotmail can do with it,
"msoegrad@gmail.com" is not available,I am sorry to not post sample to you.
|
|
|
|
 |
|
 |
I would be interested in this, can you do this, my email is 'tommie[dot]brennan[at]gmail[dot]com'.
Kind regards,
Tom.
#define STOOPID
#if STOOPID
Console.WriteLine("I'm stoopid!");
#endif
|
|
|
|
 |
|
 |
I'd like to see this, too. Please email to pastpeak[at]gmail[dot]com.
Thanks in advance!
Cheers,
Jon
|
|
|
|
 |
|
 |
I have received many mails to request sample code. I am planning to write document about storage.Please wait some day.
|
|
|
|
 |
|
 |
Please send me your project to do so...my email id is prpradip@hotmail.com
|
|
|
|
 |
|
 |
Sample code has been posted to you. please check it.
|
|
|
|
 |
|
 |
Can you send it to me too?
tata20011125(a)gmail.com
Thanks.
Glad to discuss with you and best wishes.
|
|
|
|
 |
|
 |
Have you posted this".
Could you send me a copy?
Phoskins@ac-a.com
|
|
|
|
 |
|
 |
Shouldn't the IStorage interface have a Release method, or something like that? I am not very familiar with Interop in .NET, or com programming, but I tried to read twice from a storage , and it doesn't seem to work. Perhaps it should be closed after the first read, but I don't know how.
|
|
|
|
 |
|
 |
the same problem happened to me,if open twice,"m_Storage = new IStorageWrapper(QQPath + QQID + @"\MsgEx.db");",this line will raise a error,i think it should be colosed,before you reopen it , i have tryed to call the fileobject.close method ,but it won't work.
|
|
|
|
 |
|
 |
I got the same error, file is not closed after open once.
|
|
|
|
 |
|
 |
i've managed to decompile the sources - the library works just fine, so if you're interested i can email it (of course if the author does not mind)
d3vn00ll@gmail.com
|
|
|
|
 |
|
 |
.NET Assemblies are EXTREMELY easy to reverse-engineer. If you see an article without sources, you can use microsoft's ILDASM tool to see IL-sources, or even a "Reflector" tool (sic!) to see actual C# code.
Of course, if downloadable files come with some license, and the license says "NO" - don't.
|
|
|
|
 |
|
 |
Providing of course he doesn't use a obfuscator - but it is still a pain to get it from Reflector or Ildasm
|
|
|
|
 |
|