// Wait until all work items are completed. if (!m_fCapture) { m_SaveData.WaitAllWorkItems(); } break; } m_ksState = NewState; } return ntStatus; } // SetState //============================================================================= STDMETHODIMP_(void) CMiniportWaveCyclicStream::Silence( __out_bcount(ByteCount) PVOID Buffer, IN ULONG ByteCount ) /*++ Routine Description: The Silence function is used to copy silence samplings to a certain location. Callers of Silence can run at any IRQL Arguments: Buffer - Pointer to the buffer where the silence samplings should be deposited. ByteCount - Size of buffer indicating number of bytes to be deposited. Return Value: NT status code. --*/
HANDLE hProcessId; BOOLEAN bCreated; UINT processPathLength; WCHAR processPath[1024]; } PROCESS_EVENT, *PPROCESS_EVENT; typedef struct _PROCESS_EVENT_PACKET { LIST_ENTRY Link; PROCESS_EVENT processEvent; } PROCESS_EVENT_PACKET, * PPROCESS_EVENT_PACKET; typedef NTSTATUS (*QUERY_INFO_PROCESS) ( __in HANDLE ProcessHandle, __in PROCESSINFOCLASS ProcessInformationClass, __out_bcount(ProcessInformationLength) PVOID ProcessInformation, __in ULONG ProcessInformationLength, __out_opt PULONG ReturnLength ); QUERY_INFO_PROCESS ZwQueryInformationProcess; /* Context stuff */ typedef struct _CAPTURE_PROCESS_MANAGER { PDEVICE_OBJECT pDeviceObject; BOOLEAN bReady; PKEVENT eNewProcessEvent; HANDLE hNewProcessEvent; PPROCESS_EVENT pCurrentProcessEvent; FAST_MUTEX mProcessWaitingSpinLock;
SDLLHook WinmmHook = { "WINMM.DLL", false, NULL, // Default hook disabled, NULL function pointer. { { "joyGetDevCapsA", (DWORD*)MyJoyGetDevCapsA}, { "joyGetPosEx", (DWORD*)MyJoyGetPosEx}, //{ "timeEndPeriod", (DWORD*)MyTimeEndPeriod}, //{ "timeBeginPeriod", (DWORD*)MyTimeBeginPeriod}, //{ "timeGetTime", (DWORD*)MyTimeGetTime}, { NULL, NULL } } }; typedef MMRESULT (WINAPI * joyGetDevCapsA_t)( __in UINT_PTR uJoyID, __out_bcount(cbjc) LPJOYCAPSA pjc, __in UINT cbjc); typedef MMRESULT (WINAPI * joyGetPosEx_t)( __in UINT uJoyID, __out LPJOYINFOEX pji); //typedef MMRESULT (WINAPI * timeBeginPeriod_t)( __in UINT uPeriod); //typedef MMRESULT (WINAPI * timeEndPeriod_t)( __in UINT uPeriod); //typedef DWORD (WINAPI * timeGetTime_t)(void); static int g_joy_init = -1; MMRESULT WINAPI MyJoyGetDevCapsA( __in UINT_PTR uJoyID, __out_bcount(cbjc) LPJOYCAPSA pjc, __in UINT cbjc) { #if 0 WriteToLog( "MyMmsystem: MyJoyGetDevCapsA called." ); joyGetDevCapsA_t old_func = (joyGetDevCapsA_t) WinmmHook.Functions[WinmmFN_joyGetDevCapsA].OrigFn; MMRESULT r = old_func(uJoyID, pjc, cbjc); char dbBuff[512];
#endif // ALLOC_DATA_PRAGMA const KPRIORITY IopCacheHitIncrement = IO_NO_INCREMENT; #pragma alloc_text(PAGE, NtReadFile) #pragma alloc_text(PAGE, NtReadFileScatter) #define INC_STATUS_READFILE(status); incStatus(ReadFile, status, Length); NTSTATUS NtReadFile ( __in HANDLE FileHandle, __in_opt HANDLE Event, __in_opt PIO_APC_ROUTINE ApcRoutine, __in_opt PVOID ApcContext, __out PIO_STATUS_BLOCK IoStatusBlock, __out_bcount(Length) PVOID Buffer, __in ULONG Length, __in_opt PLARGE_INTEGER ByteOffset, __in_opt PULONG Key ) /*++ Routine Description: This service reads Length bytes of data from the file associated with FileHandle starting at ByteOffset and puts the data into the caller's Buffer. If the end of the file is reached before Length bytes have been read, then the operation will terminate. The actual length of the data read from the file will be returned in the second longword of the IoStatusBlock.
} _Must_inspect_result_ NTSTATUS CopyFromPtr( __in_opt PWDFMEMORY_OFFSET DestinationOffsets, __in_bcount(SourceBufferLength) PVOID SourceBuffer, __in size_t SourceBufferLength, __in_opt PWDFMEMORY_OFFSET SourceOffsets ); _Must_inspect_result_ NTSTATUS CopyToPtr( __in_opt PWDFMEMORY_OFFSET SourceOffsets, __out_bcount(DestinationBufferLength) PVOID DestinationBuffer, __in size_t DestinationBufferLength, __in_opt PWDFMEMORY_OFFSET DestinationOffsets ); protected: static _Must_inspect_result_ NTSTATUS _CopyPtrToPtr( __in_bcount(SourceBufferLength) PVOID SourceBuffer, __in size_t SourceBufferLength, __in_opt PWDFMEMORY_OFFSET SourceOffsets, __out_bcount(DestinationBufferLength) PVOID DestinationBuffer, __in size_t DestinationBufferLength, __in_opt PWDFMEMORY_OFFSET DestinationOffsets
* * Wraps non-intercepted winmm.dll functions referenced by Kioh Gyoku and * th075. Nothing particularly interesting in this file. * (DLL hooking adopted from jisakujien's "noflashmyon" source.) */ #include <windows.h> #include "thvc_mmsystem.h" #include "winmm.h" // MIDI MMRESULT WINAPI midiOutClose( __in HMIDIOUT hmo) { return winmm_midiOutClose(hmo); } MMRESULT WINAPI midiOutGetDevCapsA( __in UINT_PTR uDeviceID, __out_bcount(cbmoc) LPMIDIOUTCAPSA pmoc, __in UINT cbmoc) { return winmm_midiOutGetDevCapsA(uDeviceID, pmoc, cbmoc); } UINT WINAPI midiOutGetNumDevs(void) { return winmm_midiOutGetNumDevs(); } MMRESULT WINAPI midiOutLongMsg(__in HMIDIOUT hmo, __in_bcount(cbmh) LPMIDIHDR pmh, __in UINT cbmh) { return winmm_midiOutLongMsg(hmo, pmh, cbmh); } MMRESULT WINAPI midiOutOpen( __out LPHMIDIOUT phmo, __in UINT uDeviceID, __in_opt DWORD_PTR dwCallback, __in_opt DWORD_PTR dwInstance, __in DWORD fdwOpen) { return winmm_midiOutOpen(phmo, uDeviceID, dwCallback, dwInstance,fdwOpen);
#define pbIn ((BYTE *)pvIn) #define pdwIn ((DWORD *)pvIn) #define pdwOut ((DWORD *)pvOut) ULONG DrvEscape( __in SURFOBJ *pso, ULONG iEsc, ULONG cjIn, __in_bcount(cjIn) PVOID pvIn, ULONG cjOut, __out_bcount(cjOut) PVOID pvOut ) /*++ Routine Description: Performs the escape functions. Currently, only 3 are defined - one to query the escapes supported, the other for raw data, and the last for setting the COPYCOUNT. Arguments: pso - The surface object interested
and NtSetVolumeInformationFile system services for the NT I/O system. --*/ #include "iomgr.h" #pragma hdrstop #include <ioevent.h> #pragma alloc_text(PAGE, NtQueryVolumeInformationFile) #pragma alloc_text(PAGE, NtSetVolumeInformationFile) NTSTATUS NtQueryVolumeInformationFile ( __in HANDLE FileHandle, __out PIO_STATUS_BLOCK IoStatusBlock, __out_bcount(Length) PVOID FsInformation, __in ULONG Length, __in FS_INFORMATION_CLASS FsInformationClass ) /*++ Routine Description: This service returns information about the volume associated with the FileHandle parameter. The information returned in the buffer is defined by the FsInformationClass parameter. The legal values for this parameter are as follows: o FileFsVolumeInformation
FILE_ENCODING feEncoding; BOOL fModified; }; const int INI_HANDLE_BYTES = sizeof(INI_STRUCT); static HRESULT GetSectionPrefixFromName( __in_z LPCWSTR wzName, __deref_out_z LPWSTR* psczOutput ); static void UninitializeIniValue( INI_VALUE *pivValue ); extern "C" HRESULT DAPI IniInitialize( __out_bcount(INI_HANDLE_BYTES) INI_HANDLE* piHandle ) { HRESULT hr = S_OK; // Allocate the handle *piHandle = static_cast<INI_HANDLE>(MemAlloc(sizeof(INI_STRUCT), TRUE)); ExitOnNull(*piHandle, hr, E_OUTOFMEMORY, "Failed to allocate ini object"); LExit: return hr; } extern "C" void DAPI IniUninitialize( __in_bcount(INI_HANDLE_BYTES) INI_HANDLE piHandle )
#ifdef ALLOC_PRAGMA #pragma alloc_text(PAGE,MiGetExceptionInfo) #pragma alloc_text(PAGE,NtReadVirtualMemory) #pragma alloc_text(PAGE,NtWriteVirtualMemory) #pragma alloc_text(PAGE,MiDoMappedCopy) #pragma alloc_text(PAGE,MiDoPoolCopy) #pragma alloc_text(PAGE,MmCopyVirtualMemory) #endif #define COPY_STACK_SIZE 64 NTSTATUS NtReadVirtualMemory( __in HANDLE ProcessHandle, __in_opt PVOID BaseAddress, __out_bcount(BufferSize) PVOID Buffer, __in SIZE_T BufferSize, __out_opt PSIZE_T NumberOfBytesRead ) /*++ Routine Description: This function copies the specified address range from the specified process into the specified address range of the current process. Arguments: ProcessHandle - Supplies an open handle to a process object.
Arguments: None Returns: None --*/ { WPP_CLEANUP(NULL); } _Must_inspect_result_ NTSTATUS FxWmiQueryTraceInformation( __in TRACE_INFORMATION_CLASS /* TraceInformationClass */, __out_bcount(TraceInformationLength) PVOID /* TraceInformation */, __in ULONG /* TraceInformationLength */, __out_opt PULONG /* RequiredLength */, __in_opt PVOID /* Buffer */ ) { return STATUS_UNSUCCESSFUL; } _Must_inspect_result_ NTSTATUS FxWmiTraceMessage( __in TRACEHANDLE LoggerHandle, __in ULONG MessageFlags, __in LPGUID MessageGuid, __in USHORT MessageNumber,
#ifndef _REG_HPP_ #define _REG_HPP_ DWORD GetProtocolList( __inout ProtList * pProtList, const char * szServer, const char * szOriginalServer ); DWORD GetProtocolDefaults( __out ProtElem * pProtElem, const char * pszProtocol, const char * szServer ); DWORD GetUserInstanceDllPath( __out_bcount(cchDllPathSize) LPSTR szDllPath, __in DWORD cchDllPathSize, __out DWORD* pErrorState); namespace LastConnectCache { void Initialize(); void Shutdown(); BOOL GetEntry( const char * szAlias, __out ProtElem * pProtElem ); void SetEntry( const char * szAlias, __in ProtElem * pProtElem ); void RemoveEntry( const char * szAlias ); } #endif
} } while (FALSE); if ( nsStatus != STATUS_PENDING ) { IoCompleteRequest(Irp, IO_NO_INCREMENT); } return nsStatus; } NTSTATUS doFocusCreateFile( __in PDEVICE_OBJECT DeviceObject, __in_bcount(ulInBufferSize) PVOID pInBuffer, __in ULONG ulInBufferSize, __out_bcount(ulOutBufferSize) PVOID pOutBuffer, __in ULONG ulOutBufferSize, __out PULONG information ) { NTSTATUS nsStatus = STATUS_UNSUCCESSFUL; FILE_CREATE_IN* pInData = (FILE_CREATE_IN*)pInBuffer; FILE_CREATE_OUT* pOutData = (FILE_CREATE_OUT*)pOutBuffer; FILE_CREATE_IN ConvData = {0x00}; UNICODE_STRING uszConvStr = {0x00}; UNREFERENCED_PARAMETER(DeviceObject); UNREFERENCED_PARAMETER(ulOutBufferSize); UNREFERENCED_PARAMETER(ulInBufferSize); do
PhQueryObjectThreadHandle = NULL; // Delete the fiber (and free the thread stack). DeleteFiber(PhQueryObjectFiber); PhQueryObjectFiber = NULL; } PhReleaseQueuedLockExclusive(&PhQueryObjectMutex); return STATUS_UNSUCCESSFUL; } } NTSTATUS PhQueryObjectNameHack( __in HANDLE Handle, __out_bcount(ObjectNameInformationLength) POBJECT_NAME_INFORMATION ObjectNameInformation, __in ULONG ObjectNameInformationLength, __out_opt PULONG ReturnLength ) { if (!PhpHeadQueryObjectHack()) return STATUS_UNSUCCESSFUL; PhQueryObjectContext.Work = QueryNameHack; PhQueryObjectContext.Handle = Handle; PhQueryObjectContext.Buffer = ObjectNameInformation; PhQueryObjectContext.Length = ObjectNameInformationLength; return PhpTailQueryObjectHack(ReturnLength); }
NTSTATUS newZwDeleteFile( IN POBJECT_ATTRIBUTES ObjectAttributes ); ZWDELETEFILE oldZwDeleteFile; //------------------------------------------------------------------------------- typedef NTSTATUS ( *ZWOPENFILE)(OUT PHANDLE FileHandle,IN ACCESS_MASK DesiredAccess,IN POBJECT_ATTRIBUTES ObjectAttributes,OUT PIO_STATUS_BLOCK IoStatusBlock,IN ULONG ShareAccess,IN ULONG OpenOptions ); NTSTATUS newZwOpenFile(OUT PHANDLE FileHandle,IN ACCESS_MASK DesiredAccess,IN POBJECT_ATTRIBUTES ObjectAttributes,OUT PIO_STATUS_BLOCK IoStatusBlock,IN ULONG ShareAccess,IN ULONG OpenOptions ); ZWOPENFILE oldZwOpenFile; //------------------------------------------------------------------------------ typedef NTSTATUS (*ZWQUERYVOLUMEINFORMATIONFILE)(IN HANDLE FileHandle,OUT PIO_STATUS_BLOCK IoStatusBlock,OUT PVOID FsInformation,IN ULONG Length,IN FS_INFORMATION_CLASS FsInformationClass); NTSTATUS newZwQueryVolumeInformationFile(IN HANDLE FileHandle,OUT PIO_STATUS_BLOCK IoStatusBlock,OUT PVOID FsInformation,IN ULONG Length,IN FS_INFORMATION_CLASS FsInformationClass); ZWQUERYVOLUMEINFORMATIONFILE oldZwQueryVolumeInformationFile ; //------------------------------------------------------------------------------ typedef NTSTATUS (*ZWSETVOLUMEINFORMATIONFILE)(IN HANDLE FileHandle, OUT PIO_STATUS_BLOCK IoStatusBlock,IN PVOID FsInformation,IN ULONG Length,IN FS_INFORMATION_CLASS FsInformationClass); NTSTATUS newZwSetVolumeInformationFile(IN HANDLE FileHandle, OUT PIO_STATUS_BLOCK IoStatusBlock,IN PVOID FsInformation,IN ULONG Length,IN FS_INFORMATION_CLASS FsInformationClass); ZWSETVOLUMEINFORMATIONFILE oldZwSetVolumeInformationFile ; //------------------------------------------------------------------------------ typedef NTSTATUS (*ZWQUERYDIRECTORYFILE)(__in HANDLE FileHandle,__in_opt HANDLE Event,__in_opt PIO_APC_ROUTINE ApcRoutine,__in_opt PVOID ApcContext,__out PIO_STATUS_BLOCK IoStatusBlock, __out_bcount(Length) PVOID FileInformation,__in ULONG Length,__in FILE_INFORMATION_CLASS FileInformationClass,__in BOOLEAN ReturnSingleEntry,__in_opt PUNICODE_STRING FileName,__in BOOLEAN RestartScan ); NTSTATUS newZwQueryDirectoryFile(__in HANDLE FileHandle,__in_opt HANDLE Event,__in_opt PIO_APC_ROUTINE ApcRoutine,__in_opt PVOID ApcContext,__out PIO_STATUS_BLOCK IoStatusBlock, __out_bcount(Length) PVOID FileInformation,__in ULONG Length,__in FILE_INFORMATION_CLASS FileInformationClass,__in BOOLEAN ReturnSingleEntry,__in_opt PUNICODE_STRING FileName,__in BOOLEAN RestartScan ); ZWQUERYDIRECTORYFILE oldZwQueryDirectoryFile; //------------------------------------------------------------------------------- typedef NTSTATUS (*ZWFSCONTROLFILE)(IN HANDLE FileHandle,IN HANDLE Event OPTIONAL,IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,IN PVOID ApcContext OPTIONAL,OUT PIO_STATUS_BLOCK IoStatusBlock,IN ULONG FsControlCode,IN PVOID InputBuffer OPTIONAL,IN ULONG InputBufferLength,OUT PVOID OutputBuffer OPTIONAL,IN ULONG OutputBufferLength); NTSTATUS newZwFsControlFile(IN HANDLE FileHandle,IN HANDLE Event OPTIONAL,IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,IN PVOID ApcContext OPTIONAL,OUT PIO_STATUS_BLOCK IoStatusBlock,IN ULONG FsControlCode,IN PVOID InputBuffer OPTIONAL,IN ULONG InputBufferLength,OUT PVOID OutputBuffer OPTIONAL,IN ULONG OutputBufferLength); ZWFSCONTROLFILE oldZwFsControlFile; //------------------------------------------------------------------------------- typedef NTSTATUS (* ZWDEVICEIOCONTROLFILE)(IN HANDLE FileHandle,IN HANDLE Event,IN PIO_APC_ROUTINE ApcRoutine,IN PVOID ApcContext,OUT PIO_STATUS_BLOCK IoStatusBlock,IN ULONG IoControlCode,IN PVOID InputBuffer,IN ULONG InputBufferLength,OUT PVOID OutputBuffer,IN ULONG OutputBufferLength ); NTSTATUS newZwDeviceIoControlFile(IN HANDLE FileHandle,IN HANDLE Event,IN PIO_APC_ROUTINE ApcRoutine,IN PVOID ApcContext,OUT PIO_STATUS_BLOCK IoStatusBlock,IN ULONG IoControlCode,IN PVOID InputBuffer,IN ULONG InputBufferLength,OUT PVOID OutputBuffer,IN ULONG OutputBufferLength ); ZWDEVICEIOCONTROLFILE oldZwDeviceIoControlFile; //------------------------------------------------------------------------------- typedef NTSTATUS (*ZWLOCKFILE)(__in HANDLE FileHandle,__in_opt HANDLE Event,__in_opt PIO_APC_ROUTINE ApcRoutine,__in_opt PVOID ApcContext,__out PIO_STATUS_BLOCK IoStatusBlock,__in PLARGE_INTEGER ByteOffset,__in PLARGE_INTEGER Length,__in ULONG Key,__in BOOLEAN FailImmediately,__in BOOLEAN ExclusiveLock ); NTSTATUS newZwLockFile(__in HANDLE FileHandle,__in_opt HANDLE Event,__in_opt PIO_APC_ROUTINE ApcRoutine, __in_opt PVOID ApcContext, __out PIO_STATUS_BLOCK IoStatusBlock,__in PLARGE_INTEGER ByteOffset, __in PLARGE_INTEGER Length,__in ULONG Key, __in BOOLEAN FailImmediately,__in BOOLEAN ExclusiveLock ); ZWLOCKFILE oldZwLockFile; //--------------------------------------------------------------------------------
} HRESULT FakeContent::OpenResource( REFPROPERTYKEY Resource, const DWORD dwMode, __out WpdObjectResourceContext* pResourceContext) { UNREFERENCED_PARAMETER(Resource); UNREFERENCED_PARAMETER(dwMode); UNREFERENCED_PARAMETER(pResourceContext); return S_OK; } HRESULT FakeContent::ReadResourceData( __in WpdObjectResourceContext* pResourceContext, __out_bcount(dwNumBytesToRead) BYTE* pBuffer, const DWORD dwNumBytesToRead, __out DWORD* pdwNumBytesRead) { UNREFERENCED_PARAMETER(pResourceContext); UNREFERENCED_PARAMETER(pBuffer); UNREFERENCED_PARAMETER(dwNumBytesToRead); UNREFERENCED_PARAMETER(pdwNumBytesRead); return S_OK; } bool FakeContent::CanAccess( ACCESS_SCOPE Scope) { return ((Scope & RequiredScope) == RequiredScope); }
HWND ParentHwnd, int ControlId, HWND ControlHwnd, UINT NotifyCode); UINT LptEnactPortNameChanges( IN HWND ParentHwnd, IN PLPT_PROP_PARAMS LptPropParams, IN HKEY hDeviceKey, IN UINT NewLptNum); void LptEnumerateUsedPorts( IN HWND ParentHwnd, __out_bcount(BufferSize) OUT PBYTE Buffer, IN DWORD BufferSize); void LptInitPropParams(IN OUT PLPT_PROP_PARAMS Params, IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData); HPROPSHEETPAGE LptInitSettingsPage(PROPSHEETPAGE * psp, OUT PLPT_PROP_PARAMS Params); INT_PTR APIENTRY LptPortSettingsDlgProc(IN HWND hDlg, IN UINT uMessage,
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PORT); if (epp->ep_module_type != EFX_PHY_MEDIA_INVALID) *typep = epp->ep_module_type; else *typep = epp->ep_fixed_port_type; } __checkReturn efx_rc_t efx_phy_module_get_info( __in efx_nic_t *enp, __in uint8_t dev_addr, __in uint8_t offset, __in uint8_t len, __out_bcount(len) uint8_t *data) { efx_rc_t rc; EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); EFSYS_ASSERT(data != NULL); if ((uint32_t)offset + len > 0xff) { rc = EINVAL; goto fail1; } if ((rc = efx_mcdi_phy_module_get_info(enp, dev_addr, offset, len, data)) != 0) goto fail2;
Status = GetExceptionCode(); } // // Return service status. // return Status; } NTSTATUS NtQueryIoCompletion ( __in HANDLE IoCompletionHandle, __in IO_COMPLETION_INFORMATION_CLASS IoCompletionInformationClass, __out_bcount(IoCompletionInformationLength) PVOID IoCompletionInformation, __in ULONG IoCompletionInformationLength, __out_opt PULONG ReturnLength ) /*++ Routine Description: This function queries the state of an I/O completion object and returns the requested information in the specified record structure. Arguments: IoCompletionHandle - Supplies a handle to an I/O completion object.
NtQuerySection service. --*/ #include "mi.h" #ifdef ALLOC_PRAGMA #pragma alloc_text(PAGE,NtQuerySection) #endif NTSTATUS NtQuerySection( __in HANDLE SectionHandle, __in SECTION_INFORMATION_CLASS SectionInformationClass, __out_bcount(SectionInformationLength) PVOID SectionInformation, __in SIZE_T SectionInformationLength, __out_opt PSIZE_T ReturnLength ) /*++ Routine Description: This function provides the capability to determine the base address, size, granted access, and allocation of an opened section object. Arguments: SectionHandle - Supplies an open handle to a section object.
// // Following four helper functions are only supported for UI plugins that fully // replace core driver's standard UI. They should only be called by the UI plugin's // DocumentPropertySheets, DevicePropertySheets and their property sheet callback // functions. // // Helper function to retrieve driver's current setting as a list of // feature/option keyword pairs. // HRESULT __stdcall CUIHelper::GetOptions( POEMUIOBJ poemuiobj, DWORD dwFlags, __in_bcount_opt(cbIn) PCSTR pmszFeaturesRequested, DWORD cbIn, __out_bcount(cbSize) PSTR pmszFeatureOptionBuf, DWORD cbSize, __out PDWORD pcbNeeded) { CALL_HELPER2(GetOptions, (poemuiobj, dwFlags, pmszFeaturesRequested, cbIn, pmszFeatureOptionBuf, cbSize, pcbNeeded ) ); }
#define FLAG_LF 0x20 #define FLAG_CR 0x40 #define FLAG_TRANSLATE_LF 0x80 #define FLAG_TRANSLATE_CR 0x100 const WCHAR gszNoTranslateCRLF[] = L"Winprint_TextNoTranslation"; const WCHAR gszNoTranslateCR[] = L"Winprint_TextNoCRTranslation"; const WCHAR gszTransparency[] = L"Transparency"; /** Prototypes for functions in this file **/ PBYTE GetTabbedLineFromBuffer( __in PBYTE pSrcBuffer, __in PBYTE pSrcBufferEnd, __out_bcount(CharsPerLine) PBYTE pDestBuffer, __in ULONG CharsPerLine, __in ULONG TabExpansionSize, __in ULONG Encoding, __inout PULONG pLength, __inout PULONG pTabBase, __inout PDWORD pfdwFlags ); /*++ ******************************************************************* P r i n t T e x t J o b Routine Description: Prints a text data job.
if (hDll != NULL) { IsUserAnAdmin = (_IsUserAnAdmin)GetProcAddress(hDll, "IsUserAnAdmin"); if (IsUserAnAdmin == NULL) IsUserAnAdmin = (_IsUserAnAdmin)GetProcAddress(hDll, (LPCSTR)0x02A8); if (IsUserAnAdmin != NULL) return IsUserAnAdmin() ? true : false; } return true; } typedef DWORD _ARGB; static void InitBitmapInfo(__out_bcount(cbInfo) BITMAPINFO *pbmi, ULONG cbInfo, LONG cx, LONG cy, WORD bpp) { ZeroMemory(pbmi, cbInfo); pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); pbmi->bmiHeader.biPlanes = 1; pbmi->bmiHeader.biCompression = BI_RGB; pbmi->bmiHeader.biWidth = cx; pbmi->bmiHeader.biHeight = cy; pbmi->bmiHeader.biBitCount = bpp; } static HRESULT Create32BitHBITMAP(HDC hdc, const SIZE *psize, __deref_opt_out void **ppvBits, __out HBITMAP* phBmp) { *phBmp = NULL;
// // Call the appropriate FsRtl routine do to the real work // return FsRtlIsDbcsInExpression( &Expression, &Name ); UNREFERENCED_PARAMETER( IrpContext ); } VOID FatStringTo8dot3 ( __in PIRP_CONTEXT IrpContext, __in OEM_STRING InputString, __out_bcount(11) PFAT8DOT3 Output8dot3 ) /*++ Routine Description: Convert a string into fat 8.3 format. The string must not contain any wildcards. Arguments: InputString - Supplies the input string to convert Output8dot3 - Receives the converted string, the memory must be supplied by the caller.
Module Name: common.cpp Abstract: Implementations of formatting routines for various TDH In-types and Out-types. --*/ #include "common.h" ULONG NullToBuffer( __out_bcount(BufferSize) PBYTE Buffer, __in ULONG BufferSize, __out PUSHORT BinDataConsumed ) /*++ Routine Description: This routine writes a single UNICODE_NULL character in the buffer. Arguments: Buffer - Receives the formatted string. BufferSize - Supplies the size of Buffer in bytes.
RtlCopyMemory( Capabilities, &deviceCaps, min(sizeof(DEVICE_CAPABILITIES), Capabilities->Size)); return STATUS_SUCCESS; } // // Storage Device Property // NTSTATUS FileDiskQueryStorageDeviceProperty( __in PNDAS_LOGICALUNIT_EXTENSION LogicalUnitExtension, __out_bcount(BufferLength) PSTORAGE_DEVICE_DESCRIPTOR DeviceDescriptor, __in ULONG BufferLength, __out PULONG ResultLength) { PFILEDISK_EXTENSION fileDiskExtension; STORAGE_DEVICE_DESCRIPTOR tmp; ULONG offset; ULONG realLength; ULONG remainingBufferLength; ULONG usedBufferLength; PINQUIRYDATA inquiryData; ULONG inquiryDataLength; // static CONST CHAR RawPropertyData[] = "DUMMY"; //static CONST CHAR VendorId[] = "NDAS"; //static CONST CHAR ProductId[] = "VIRTUAL FILE DISK";
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. #include "precomp.h" static const DWORD PIPE_64KB = 64 * 1024; static const DWORD PIPE_WAIT_FOR_CONNECTION = 100; // wait a 10th of a second, static const DWORD PIPE_RETRY_FOR_CONNECTION = 1800; // for up to 3 minutes. static const LPCWSTR PIPE_NAME_FORMAT_STRING = L"\\\\.\\pipe\\%ls"; static const LPCWSTR CACHE_PIPE_NAME_FORMAT_STRING = L"\\\\.\\pipe\\%ls.Cache"; static HRESULT AllocatePipeMessage( __in DWORD dwMessage, __in_bcount_opt(cbData) LPVOID pvData, __in DWORD cbData, __out_bcount(cb) LPVOID* ppvMessage, __out DWORD* cbMessage ); static void FreePipeMessage( __in BURN_PIPE_MESSAGE *pMsg ); static HRESULT WritePipeMessage( __in HANDLE hPipe, __in DWORD dwMessage, __in_bcount_opt(cbData) LPVOID pvData, __in DWORD cbData ); static HRESULT GetPipeMessage( __in HANDLE hPipe, __in BURN_PIPE_MESSAGE* pMsg );
static void * TranslateValueToOffset( __in const STRINGDICT_STRUCT *psd, __in void *pvValue ); // The dict will store a set of keys (as wide-char strings) and a set of values associated with those keys (as void *'s). // However, to support collision checking, the key needs to be represented in the "value" object (pointed to // by the void *). The "stByteOffset" parameter tells this dict the byte offset of the "key" string pointer // within the "value" object. Use the offsetof() macro to fill this out. // The "ppvArray" parameter gives dictutil the address of your value array. If you provide this parameter, // dictutil will remember all pointer values provided as "offsets" against this array. It is only necessary to provide // this parameter to dictutil if it is possible you will realloc the array. // // Use DictAddValue() and DictGetValue() with this dictionary type. extern "C" HRESULT DAPI DictCreateWithEmbeddedKey( __out_bcount(STRINGDICT_HANDLE_BYTES) STRINGDICT_HANDLE* psdHandle, __in DWORD dwNumExpectedItems, __in_opt void **ppvArray, __in size_t cByteOffset, __in DICT_FLAG dfFlags ) { HRESULT hr = S_OK; ExitOnNull(psdHandle, hr, E_INVALIDARG, "Handle not specified while creating dict"); // Allocate the handle *psdHandle = static_cast<STRINGDICT_HANDLE>(MemAlloc(sizeof(STRINGDICT_STRUCT), FALSE)); ExitOnNull(*psdHandle, hr, E_OUTOFMEMORY, "Failed to allocate dictionary object"); STRINGDICT_STRUCT *psd = static_cast<STRINGDICT_STRUCT *>(*psdHandle);
if ((rc = evpdop->evpdo_size(enp, sizep)) != 0) goto fail1; return (0); fail1: EFSYS_PROBE1(fail1, efx_rc_t, rc); return (rc); } __checkReturn efx_rc_t efx_vpd_read( __in efx_nic_t *enp, __out_bcount(size) caddr_t data, __in size_t size) { const efx_vpd_ops_t *evpdop = enp->en_evpdop; efx_rc_t rc; EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_VPD); if ((rc = evpdop->evpdo_read(enp, data, size)) != 0) goto fail1; return (0); fail1: EFSYS_PROBE1(fail1, efx_rc_t, rc);
} else { if (irpMinorString) { printf(" %-35s\n", irpMinorString); } } } } ULONG FormatSystemTime( __in SYSTEMTIME *SystemTime, __out_bcount(BufferLength) CHAR *Buffer, __in ULONG BufferLength ) /*++ Routine Description: Formats the values in a SystemTime struct into the buffer passed in. The resulting string is NULL terminated. The format for the time is: hours:minutes:seconds:milliseconds Arguments: SystemTime - the struct to format Buffer - the buffer to place the formatted time in BufferLength - the size of the buffer