Click here to Skip to main content
15,885,309 members
Home / Discussions / C#
   

C#

 
AnswerRe: Revit macro with if/else command Pin
Eddy Vluggen10-Dec-14 0:32
professionalEddy Vluggen10-Dec-14 0:32 
Questionplease help me solve a nested dictionary structure problem!!! (here is a sample code where am i doing wrong) Pin
gajanangan9-Dec-14 7:22
gajanangan9-Dec-14 7:22 
SuggestionRe: please help me solve a nested dictionary structure problem!!! (here is a sample code where am i doing wrong) Pin
gaurigan9-Dec-14 16:17
gaurigan9-Dec-14 16:17 
QuestionRe: please help me solve a nested dictionary structure problem!!! (here is a sample code where am i doing wrong) Pin
Richard MacCutchan9-Dec-14 22:15
mveRichard MacCutchan9-Dec-14 22:15 
AnswerSolved :please help me solve a nested dictionary structure problem!!! (here is a sample code where am i doing wrong) Pin
gaurigan10-Dec-14 13:56
gaurigan10-Dec-14 13:56 
Questionproblem finding control and getting its values for dynamically created textboxes Pin
Dhyanga9-Dec-14 5:34
Dhyanga9-Dec-14 5:34 
SuggestionRe: problem finding control and getting its values for dynamically created textboxes Pin
Richard Deeming9-Dec-14 6:34
mveRichard Deeming9-Dec-14 6:34 
Questiontrouble to allocate/read buffer modified by native function Pin
Member 111038219-Dec-14 0:20
Member 111038219-Dec-14 0:20 
I'm trying to read the buffer modified by the native function ntQueryEaFile.

Here is it's definition :
C++
NTSTATUS NtQueryEaFile
 (
  HANDLE           hFile,
  PIO_STATUS_BLOCK iosb,
  PVOID            buffer,
  ULONG            length,
  BOOLEAN          single_entry,
  PVOID            ea_list,
  ULONG            ea_list_len,
  PULONG           ea_index,
  BOOLEAN          restart
 )


I'm having trouble with the PVOID buffer (output buffer). The description reads :

"Caller's allocated buffer for output data. See FILE_FULL_EA_INFORMATION for detailed description of fields avaiable in buffer."

Here is the C++ def of this struct:
CSS
typedef struct _FILE_FULL_EA_INFORMATION {
  ULONG  NextEntryOffset;
  UCHAR  Flags;
  UCHAR  EaNameLength;
  USHORT EaValueLength;
  CHAR   EaName[1];
} FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;




Now my C# code:
C#
[DllImport("ntdll.dll")]
        public static extern uint NtQueryEaFile(
            Microsoft.Win32.SafeHandles.SafeFileHandle handle,
            ref IO_STATUS_BLOCK iosb,
            out IntPtr buffer,
            uint  length,
            byte single_entry,
            IntPtr eaList,
            uint ea_list_len,
            IntPtr ea_index,
            byte restart
            );

        public struct FILE_FULL_EA_INFORMATION
        {
            public uint NextEntryOffset;
            public byte Flags;
            public byte EaNameLength;
            public ushort EaValueLength;
            [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 1)]
            public string EaName;
        }      
        public const int MAX_EA_NAME_LEN = 256;
        public const int MAX_EA_VALUE_LEN = 65536;


and the function call :
C#
FILE_FULL_EA_INFORMATION FEAI = new FILE_FULL_EA_INFORMATION();
int EA_BUFSIZ = Marshal.SizeOf(FEAI) +  MAX_EA_NAME_LEN + MAX_EA_VALUE_LEN;
IntPtr p_FEAI = Marshal.AllocHGlobal(EA_BUFSIZ);
Marshal.StructureToPtr(FEAI, p_FEAI, false);

status = NtQueryEaFile(hFile, ref ioStatusBlock, out p_FEAI, System.Convert.ToUInt32(EA_BUFSIZ), returnSingleEntry, IntPtr.Zero, 0, IntPtr.Zero, restartScan); 


status returns
VB
0xC0000005
STATUS_ACCESS_VIOLATION



Any ideas how to fix this ? Thanks for your help !
AnswerRe: trouble to allocate/read buffer modified by native function Pin
Richard MacCutchan9-Dec-14 6:08
mveRichard MacCutchan9-Dec-14 6:08 
QuestionTime out Expires while generating report. Pin
Pushpak Shah8-Dec-14 20:44
professionalPushpak Shah8-Dec-14 20:44 
QuestionRemote powershell / WinRM to Server 2012 Pin
JD868-Dec-14 18:49
JD868-Dec-14 18:49 
SuggestionRe: Remote powershell / WinRM to Server 2012 Pin
Richard MacCutchan8-Dec-14 22:07
mveRichard MacCutchan8-Dec-14 22:07 
GeneralRe: Remote powershell / WinRM to Server 2012 Pin
JD869-Dec-14 3:19
JD869-Dec-14 3:19 
GeneralRe: Remote powershell / WinRM to Server 2012 Pin
Richard MacCutchan9-Dec-14 5:49
mveRichard MacCutchan9-Dec-14 5:49 
GeneralRe: Remote powershell / WinRM to Server 2012 Pin
JD8610-Dec-14 5:09
JD8610-Dec-14 5:09 
QuestionCreate a nested TreeView for Windows 8.1 app Pin
Bhola S. Parit8-Dec-14 18:20
Bhola S. Parit8-Dec-14 18:20 
AnswerRe: Create a nested TreeView for Windows 8.1 app Pin
BillWoodruff8-Dec-14 21:26
professionalBillWoodruff8-Dec-14 21:26 
Questionrtl gridview Pin
alireza.zahani8-Dec-14 3:36
alireza.zahani8-Dec-14 3:36 
AnswerRe: rtl gridview Pin
alireza.zahani8-Dec-14 3:46
alireza.zahani8-Dec-14 3:46 
GeneralRe: rtl gridview Pin
Blue_Boy8-Dec-14 5:26
Blue_Boy8-Dec-14 5:26 
AnswerRe: rtl gridview Pin
Eddy Vluggen8-Dec-14 8:05
professionalEddy Vluggen8-Dec-14 8:05 
Questionconvert NTP to UTC datetime Pin
Jassim Rahma8-Dec-14 1:31
Jassim Rahma8-Dec-14 1:31 
AnswerRe: convert NTP to UTC datetime Pin
Richard MacCutchan8-Dec-14 1:33
mveRichard MacCutchan8-Dec-14 1:33 
AnswerRe: convert NTP to UTC datetime Pin
BillWoodruff8-Dec-14 1:55
professionalBillWoodruff8-Dec-14 1:55 
QuestionDatagridview with tabcontrol in windows application Pin
Rahulmishra0117-Dec-14 19:07
Rahulmishra0117-Dec-14 19:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.