RAPI - CeOpenDatabase,CeReadRecordProps,CeCreateDatabase - DllImport with C#

Hello,

Can someone show me how can i import thoose functions (DataBase functions) with DllImport in C#

Thank You.
natan1107Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mikal613Commented:
public const short FILE_ATTRIBUTE_NORMAL = 0x80;public const short INVALID_HANDLE_VALUE = -1;public const uint GENERIC_READ = 0x80000000;public const uint GENERIC_WRITE = 0x40000000;public const short CREATE_NEW = 1;public const short CREATE_ALWAYS = 2;public const short OPEN_EXISTING = 3;public const short ERROR_FILE_EXISTS = 80;public const short ERROR_INVALID_PARAMETER = 87;public const short ERROR_DISK_FULL = 112;[StructLayout(LayoutKind.Sequential)]public struct OSVERSIONINFO{public int dwOSVersionInfoSize;public int dwMajorVersion;public int dwMinorVersion;public int dwBuildNumber;public int dwPlatformId;[MarshalAs(UnmanagedType.ByValTStr,SizeConst= 128)]public string szCSDVersion;}[StructLayout(LayoutKind.Sequential)]public struct RAPIINIT{int cbSize;int heRapiInit;int hrRapiInit;}[StructLayout(LayoutKind.Sequential)]public struct SECURITY_ATTRIBUTES{public int nLength;public int lpSecurityDescriptor;public int bInheritHandle;}[DllImport("rapi.dll", CharSet=CharSet.Unicode)]public static extern int CeCloseHandle(int hObject);[DllImport("rapi.dll", CharSet=CharSet.Unicode)]public static extern int CeCreateFile(string lpFileName,uint dwDesiredAccess,int dwShareMode,int lpSecurityAttributes,intdwCreationDisposition,int dwFlagsAndAttributes,int hTemplateFile);[DllImport("rapi.dll", CharSet=CharSet.Unicode)]public static extern int CeRapiInitEx ([MarshalAs(UnmanagedType.Struct)] ref RAPIINIT pRapiInit);[DllImport("rapi.dll", CharSet=CharSet.Unicode)]public static extern int CeRapiInit ();[DllImport("rapi.dll", CharSet=CharSet.Unicode)]public static extern int CeRapiUninit ();[DllImport("rapi.dll", CharSet=CharSet.Unicode)]public static extern int CeReadFile(int hFile,StringBuilder lpBuffer,int nNumberOfbytesToRead, out int lpNumberOfbytesRead, int lpOverlapped);[DllImport("rapi.dll", CharSet=CharSet.Unicode)]public static extern int CeWriteFile(int hFile,StringBuilder lpBuffer, int nNumberOfbytesToWrite, out int lpNumberOfbytesWritten, int lpOverlapped);[DllImport("rapi.dll", CharSet=CharSet.Unicode)]public static extern int GetLastError();[DllImport("rapi.dll", CharSet=CharSet.Unicode)]public static extern int CeSetEndOfFile(int hFile);[DllImport("rapi.dll", CharSet=CharSet.Unicode)]public static extern int CeGetFileSize(int hFile,int lpFileSizeHigh);[DllImport("rapi.dll", CharSet=CharSet.Unicode)]public static extern int CeGetLastError();
0
Mikal613Commented:
0
natan1107Author Commented:
all DllImport are ok, but there is no fuction that know to open a database !
I need the flowing funcitons:
CeOpenDatabase,CeReadRecordProps,CeCreateDatabase.
 I need to call them by C#,
I know that I can do it with C++
Thank You
0
Mikal613Commented:
[DllImport("rapi.dll", CharSet=CharSet.Unicode)]
Public static extern CeOpenDatabase(  PCEOID poid,LPWSTR lpszName,CEPROPID propid,DWORD dwFlags,HWND hwndNotify);
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Smartphone Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.