hello,
i am trying to get sid from a 64 driver from a 32 bit application. here is my code to do that.
typedef struct sid_event_t
{
…
…
ULONG_PTR fileobj;
ULONG sa_size;
SID_AND_ATTRIBUTES sa;
UCHAR sid[1];
} sid_event_t;
i am using the Zw API to get the sid. it works i could see the sid in the debugger.
however when i send this to 32 bit app upon IOCTL then in the user mode app IsVAlidSid reports that it is invalid sid. i doubt that this is a 64 bit thunking issue.
here is my IOCTL code
BYTE m_ioctlBuf[IOCTL_BUF_SIZE];
BOOL rc = DeviceIoControl(m_hDriver, IOCTL_READ_EVENT, NULL, 0,
m_ioctlBuf, sizeof(m_ioctlBuf), &m_ioctlBytesReturned, &m_olIoctl);
in side the driver i typecast it and then return it
NTSTATUS copyToUser(PIRP irp, PIO_STACK_LOCATION irps, sid_event_t *evt, PULONG info)
{
NTSTATUS status;
sid_event_t*data;
ULONG cbout = irps->Parameters.DeviceIoControl.OutputBufferLength;
if (cbout < calcRequiredBufSize(evt))
{
status = STATUS_INVALID_BUFFER_SIZE;
goto error;
}
data = (sid_event_t *)MmGetSystemAddressForMdlSafe(irp->MdlAddress, NormalPagePriority);
if (!data)
{
status = STATUS_INSUFFICIENT_RESOURCES;
goto error;
}
data->fileobj = evt->fileobj;
data->sa_size = evt->sa_size;
if (evt->sa)
RtlCopyMemory(&data->sa, evt->sa, evt->sa_size);
data->sa.Sid = NULL;
status = STATUS_SUCCESS;
error:
return status;
}
now in the application i use
CSid sid;
_ATLTRY
{
sid.LoadAccount((const SID *)evt->sa.Sid);
sid.AccountName();
}
_ATLCATCHALL()
{
//fails here
}
could someone show a light on this?
regards
d