Code:
void getFileOwner(const char *complete_filename, char *user)
{
if (!initSharedMem(1024 + (strlen(complete_filename) + 1) + sizeof(DC_VFS))) {
strcpy(user,"nobody");
return;
}
lpMessage->dwIdentifier = DC_VFS_READ;
LPDC_VFS pFileInformation = (LPDC_VFS)lpMessage->lpContext;
lpContext = (LPVOID)((ULONG)lpMessage->lpContext + sizeof(DC_VFS));
strcpy((LPTSTR)pFileInformation->pBuffer,complete_filename);
dwReturn = SendMessage(hIoFTPD, WM_SHMEM, NULL, (LPARAM)hMemory);
if (!dwReturn) {
WaitForSingleObject(hEvent,10000);
int uid = pFileInformation->Uid;
if (pFileInformation->dwFileMode==0 || !resolveUidToName(uid,user))
strcpy(user,"nobody");
} else {
strcpy(user,"nobody");
}
closeSharedMem();
}