Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2004-11-16
6
Medium Priority
?
1,004 Views
Last Modified: 2013-11-18
Hello,

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

Thank You.
0
Comment
Question by:natan1107
  • 3
4 Comments
 
LVL 48

Expert Comment

by:Mikal613
ID: 12593401
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
 
LVL 48

Expert Comment

by:Mikal613
ID: 12593421
0
 

Author Comment

by:natan1107
ID: 12594637
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
 
LVL 48

Accepted Solution

by:
Mikal613 earned 2000 total points
ID: 12594988
[DllImport("rapi.dll", CharSet=CharSet.Unicode)]
Public static extern CeOpenDatabase(  PCEOID poid,LPWSTR lpszName,CEPROPID propid,DWORD dwFlags,HWND hwndNotify);
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface: This article is part of a series focused on cross platform mobile app development (specifically Android and iOS) using the Alloy framework and Titanium Studio made by Appcelerator (https://www.appcelerator.com/). This article presumes a wor…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…
Suggested Courses

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question