} else { if (irpMinorString) { printf(" %-35s\n", irpMinorString); } } } } ULONG FormatSystemTime( _In_ SYSTEMTIME *SystemTime, _Out_writes_bytes_(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
APIENTRY NtGdiBRUSHOBJ_DeleteRbrush( _In_opt_ BRUSHOBJ *pbo, _In_opt_ BRUSHOBJ *pboB) { UNIMPLEMENTED; return 0; } __kernel_entry BOOL APIENTRY NtGdiCLIPOBJ_bEnum( _In_ CLIPOBJ *pco, _In_ ULONG cj, _Out_writes_bytes_(cj) ULONG *pul) { UNIMPLEMENTED; return FALSE; } __kernel_entry ULONG APIENTRY NtGdiCLIPOBJ_cEnumStart( _In_ CLIPOBJ *pco, _In_ BOOL bAll, _In_ ULONG iType, _In_ ULONG iDirection, _In_ ULONG cLimit) {
NTSTATUS CMiniportWaveRTStream::GetVolumeChannelCount(_Out_ UINT32 *_puiChannelCount) { PAGED_CODE(); DPF_ENTER(("[CMiniportWaveRTStream::GetVolumeChannelCount]")); ASSERT(_puiChannelCount); ASSERT(m_pWfExt); NTSTATUS ntStatus = STATUS_SUCCESS; *_puiChannelCount = m_pWfExt->Format.nChannels; return ntStatus; } #pragma code_seg("PAGE") NTSTATUS CMiniportWaveRTStream::GetVolumeSteppings(_Out_writes_bytes_(_ui32DataSize) PKSPROPERTY_STEPPING_LONG _pKsPropStepLong, _In_ UINT32 _ui32DataSize) { PAGED_CODE (); UINT32 ulChannelCount = _ui32DataSize / sizeof(KSPROPERTY_STEPPING_LONG); ASSERT (_pKsPropStepLong); DPF_ENTER(("[CMiniportWaveRTStream::GetVolumeSteppings]")); if (ulChannelCount != m_pWfExt->Format.nChannels) { return STATUS_INVALID_PARAMETER; } for(UINT i = 0; i < ulChannelCount; i++) { _pKsPropStepLong[i].SteppingDelta = VOLUME_STEPPING_DELTA; _pKsPropStepLong[i].Bounds.SignedMaximum = VOLUME_SIGNED_MAXIMUM;
* This only for MirrorEnumerateNamedStreams. Link with ntdll.lib still required. * * Not needed if you're not using NtQueryInformationFile! * * BEGIN */ typedef struct _IO_STATUS_BLOCK { union { NTSTATUS Status; PVOID Pointer; } DUMMYUNIONNAME; ULONG_PTR Information; } IO_STATUS_BLOCK, *PIO_STATUS_BLOCK; NTSYSCALLAPI NTSTATUS NTAPI NtQueryInformationFile(_In_ HANDLE FileHandle, _Out_ PIO_STATUS_BLOCK IoStatusBlock, _Out_writes_bytes_(Length) PVOID FileInformation, _In_ ULONG Length, _In_ FILE_INFORMATION_CLASS FileInformationClass); /** * END */ static int DOKAN_CALLBACK MirrorEnumerateNamedStreams( LPCWSTR FileName, PVOID* EnumContext, LPWSTR StreamName, PULONG StreamNameLength, PLONGLONG StreamSize, PDOKAN_FILE_INFO DokanFileInfo) { HANDLE handle; WCHAR filePath[MAX_PATH];
Length |= READ_PORT_UCHAR( &IOBase->SizeLSReg ); // perform a dummy read while ( Length-- ) { READ_PORT_UCHAR( &IOBase->DataReg ); } WRITE_PORT_UCHAR( &IOBase->CmdStatusReg, CLEAR_BIT ); } return; } NTSTATUS PscrRead( _In_ PREADER_EXTENSION ReaderExtension, // context of call _Out_writes_bytes_(DataLen) PUCHAR pData, // ptr to data buffer _In_ ULONG DataLen, // length of data _Out_ PULONG pNBytes // number of bytes read ) /*++ PscrRead: wait until data available & transfer data from reader to host Arguments: ReaderExtension context of call pData ptr to data buffer DataLen length of data buffer pNBytes number of bytes returned Return Value: STATUS_SUCCESS
if (MungedName.Buffer != NULL) { ExFreePoolWithTag( MungedName.Buffer, NC_GENERATE_NAME_TAG ); } return Status; } NTSTATUS NcNormalizeNameComponentEx ( _In_ PFLT_INSTANCE Instance, _In_opt_ PFILE_OBJECT FileObject, _In_ PCUNICODE_STRING ParentDirectory, _In_ USHORT DeviceNameLength, _In_ PCUNICODE_STRING Component, _Out_writes_bytes_(ExpandComponentNameLength) PFILE_NAMES_INFORMATION ExpandComponentName, _In_ ULONG ExpandComponentNameLength, _In_ FLT_NORMALIZE_NAME_FLAGS Flags, _Inout_ PVOID *NormalizationContext ) { NTSTATUS Status; PNC_INSTANCE_CONTEXT InstanceContext = NULL; NC_PATH_OVERLAP ParentOverlap; //overlap between the parent path and the user mapping. UNICODE_STRING Remainder; UNICODE_STRING MungedParentPath; // Path we are going to open for query PCUNICODE_STRING MungedComponent; // File name to enumerate PWSTR MungedBuffer = NULL; ULONG MungedBufferLength;
#define TTY_INFO_CODEPAGE 2 #define TTY_INFO_NUM_UFMS 3 #define TTY_INFO_UFM_IDS 4 #define NUM_UFMS 3 // for internal use only. use TTY_INFO_NUM_UFMS // to query number of font sizes supported. //////////////////////////////////////////////////////// // INTERNAL PROTOTYPES //////////////////////////////////////////////////////// BOOL TextGetInfo( DWORD dwInfo, _Out_writes_bytes_(cbSize) PVOID pBuffer, DWORD cbSize, _Out_ PDWORD pcbNeeded ) { // Validate parameters. if( ( (OEMGI_GETSIGNATURE != dwInfo) && (OEMGI_GETINTERFACEVERSION != dwInfo) && (OEMGI_GETVERSION != dwInfo) ) || (NULL == pcbNeeded) )
**************************************************************************/ #ifdef ALLOC_PRAGMA #pragma code_seg() #endif // ALLOC_PRAGMA // suppressed due to Esp:773 #pragma warning (push) #pragma warning( disable:26015 ) // Suppress OACR error. Seems nonsensical. TODO: Must revisit. #pragma warning( disable:26019 ) _Success_(return > 0) ULONG CRGB24Synthesizer:: Commit( _Out_writes_bytes_(Size) PUCHAR Buffer, _In_ ULONG Size, _In_ ULONG Stride ) /*++ Routine Description: Copy (and reformat, if necessary) pixels from the internal scratch buffer. If the output format decimates chrominance, do it here. Arguments: Buffer - The output buffer to fill.
PWCHAR pTabsKey = L"TABS"; PWCHAR pCopiesKey = L"COPIES"; /** Prototypes **/ /** Functions found in parsparm.c **/ extern USHORT GetKeyValue( _In_ PWCHAR pParmString, _In_ PWCHAR pKeyName, _In_ USHORT ValueType, _Inout_ PUSHORT pDestLength, _Out_writes_bytes_(*pDestLength) PVOID pDestBuffer ); /** Functions found in raw.c **/ extern BOOL PrintRawJob( IN PPRINTPROCESSORDATA, _In_ IN LPWSTR); /** Functions found in text.c **/ extern BOOL PrintTextJob( IN PPRINTPROCESSORDATA, _In_ IN LPWSTR);
if (!pName) return NULL; LcmSplInSem(); while (pIniEntry && lstrcmpi(pName, pIniEntry->pName)) pIniEntry = pIniEntry->pNext; return pIniEntry; } LPBYTE LcmPackStrings( _In_ DWORD dwElementsCount, _In_reads_(dwElementsCount) LPCWSTR *pSource, _Out_writes_bytes_(pDest-pEnd) LPBYTE pDest, _In_reads_(dwElementsCount) DWORD *DestOffsets, _Inout_updates_(_Inexpressible_("Involves negative offsets.")) LPBYTE pEnd ) { DWORD dwCount = 0; for (dwCount = 0; dwCount < dwElementsCount; dwCount++) { if (*pSource) { #pragma prefast(suppress:__WARNING_POTENTIAL_BUFFER_OVERFLOW_NULLTERMINATED, "Just getting the length of current string, index of psource is correctly limited") size_t cbString = wcslen(*pSource)*sizeof(WCHAR) + sizeof(WCHAR); pEnd-= cbString; (VOID) StringCbCopy ((LPWSTR) pEnd, cbString, *pSource);
return (((PFN_DrvSendPage)(poempdev->pfnPS[UD_DrvSendPage]))(pso)); } // // OEMEscape // ULONG APIENTRY OEMEscape( SURFOBJ *pso, ULONG iEsc, ULONG cjIn, _In_reads_bytes_(cjIn) PVOID pvIn, ULONG cjOut, _Out_writes_bytes_(cjOut) PVOID pvOut ) { PDEVOBJ pdevobj; POEMPDEV poempdev; VERBOSE("OEMEscape() entry.\r\n"); pdevobj = (PDEVOBJ)pso->dhpdev; poempdev = (POEMPDEV)pdevobj->pdevOEM; // // turn around to call PS // return (((PFN_DrvEscape)(poempdev->pfnPS[UD_DrvEscape])) (
); // Check if we're trying to terminate the current process, // because kernel-mode can't do it. if (status == STATUS_CANT_TERMINATE_SELF) { RtlExitUserProcess(ExitStatus); } return status; } NTSTATUS KphReadVirtualMemory( _In_ HANDLE ProcessHandle, _In_ PVOID BaseAddress, _Out_writes_bytes_(BufferSize) PVOID Buffer, _In_ SIZE_T BufferSize, _Out_opt_ PSIZE_T NumberOfBytesRead ) { struct { HANDLE ProcessHandle; PVOID BaseAddress; PVOID Buffer; SIZE_T BufferSize; PSIZE_T NumberOfBytesRead; } input = { ProcessHandle, BaseAddress, Buffer, BufferSize, NumberOfBytesRead }; return KphpDeviceIoControl( KPH_READVIRTUALMEMORY,
*R ^= ROL32(*L, 17); *L += *R; *R ^= ((*L & 0xff00ff00) >> 8) | ((*L & 0x00ff00ff) << 8); *L += *R; *R ^= ROL32(*L, 3); *L += *R; *R ^= ROR32(*L, 2); *L += *R; } NDIS_STATUS HwCalculateTxMIC( _In_ PNET_BUFFER NetBuffer, _In_ UCHAR Priority, _In_reads_bytes_(8) PUCHAR MICKey, _Out_writes_bytes_(HW_MIC_LENGTH) PUCHAR MICData ) { ULONG L, R; ULONG length; PMDL mdl; ULONG offset; PUCHAR bytePtr; ULONG index; ULONG count; ULONG dataSize; ULONG data; PUCHAR SA; PUCHAR DA; ULONG headerSize; PDOT11_DATA_LONG_HEADER dataHeader;
sea::FinitaLaComedia(); #ifdef _WIN32 EventUnregisterIntelSEAPI(); #endif } } void AtExit() { __itt_api_fini(nullptr); } #ifdef _WIN32 typedef Gdiplus::GpStatus(WINGDIPAPI * FGdipGetImageEncoders)(_In_ UINT numEncoders, _In_ UINT size, _Out_writes_bytes_(size) Gdiplus::ImageCodecInfo *encoders); typedef Gdiplus::GpStatus(WINGDIPAPI * FGdipGetImageEncodersSize)(_Out_ UINT *numEncoders, _Out_ _Out_range_(>= , (*numEncoders) * sizeof(ImageCodecInfo)) UINT *size); typedef Gdiplus::Status(WINAPI * FGdiplusStartup)(OUT ULONG_PTR *token, const Gdiplus::GdiplusStartupInput *input, OUT Gdiplus::GdiplusStartupOutput *output); typedef VOID(WINAPI * FGdiplusShutdown)(ULONG_PTR token); typedef Gdiplus::Status(WINAPI * FGdiplusStartup)(OUT ULONG_PTR *token, const Gdiplus::GdiplusStartupInput *input, OUT Gdiplus::GdiplusStartupOutput *output); typedef Gdiplus::GpStatus(WINGDIPAPI* FGdipSaveImageToFile)(Gdiplus::GpImage *image, GDIPCONST WCHAR* filename, GDIPCONST CLSID* clsidEncoder, GDIPCONST Gdiplus::EncoderParameters* encoderParams); typedef Gdiplus::GpStatus(WINGDIPAPI* FGdipDisposeImage)(Gdiplus::GpImage *image); typedef Gdiplus::GpStatus(WINGDIPAPI* FGdipCreateBitmapFromHICON)(HICON hicon, Gdiplus::GpBitmap** bitmap); typedef Gdiplus::GpStatus(WINGDIPAPI* FGdipBitmapSetPixel)(Gdiplus::GpBitmap* bitmap, INT x, INT y, Gdiplus::ARGB color); typedef Gdiplus::GpStatus(WINGDIPAPI* FGdipBitmapGetPixel)(Gdiplus::GpBitmap* bitmap, INT x, INT y, Gdiplus::ARGB *color); typedef Gdiplus::GpStatus(WINGDIPAPI* FGdipCreateBitmapFromHBITMAP)(HBITMAP hbm, HPALETTE hpal, Gdiplus::GpBitmap** bitmap); typedef Gdiplus::GpStatus(WINGDIPAPI* FGdipLoadImageFromFile)(GDIPCONST WCHAR* filename, Gdiplus::GpBitmap** image); typedef Gdiplus::GpStatus(WINGDIPAPI* FGdipGetImagePixelFormat)(Gdiplus::GpImage *image, Gdiplus::PixelFormat *format); typedef Gdiplus::GpStatus(WINGDIPAPI* FGdipCreateBitmapFromScan0)(INT width, INT height, INT stride, Gdiplus::PixelFormat format, _In_reads_opt_(_Inexpressible_("height * stride")) BYTE* scan0, _Outptr_ Gdiplus::GpBitmap** bitmap); typedef Gdiplus::GpStatus(WINGDIPAPI* FGdipGetImageWidth)(Gdiplus::GpImage *image, UINT *width); typedef Gdiplus::GpStatus(WINGDIPAPI* FGdipGetImageHeight)(Gdiplus::GpImage *image, UINT *height);
} else hr = E_NOTIMPL; ExitScannerSession(pValue->pScanInfo, pContext); } break; default: Trace(TEXT("Unknown Command (%d)"), lCommand); break; } return hr; } WIAMICRO_API HRESULT Scan(_Inout_ PSCANINFO pScanInfo, LONG lPhase, _Out_writes_bytes_(lLength) PBYTE pBuffer, LONG lLength, _Out_ LONG *plReceived) { // online PWIASANE_Context pContext; SANE_Status status; LONG idx, aquire, aquired; DWORD receive; HANDLE hHeap; HRESULT hr; Trace(TEXT("------ Scan(lPhase=%d, lLength=%d) ------"), lPhase, lLength); if (plReceived) *plReceived = 0; if (!pScanInfo) return E_INVALIDARG;
#include "uvcview.h" /***************************************************************************** DriverNameToDeviceInst() Finds the Device instance of the DevNode with the matching DriverName. Returns FALSE if the matching DevNode is not found and TRUE if found *****************************************************************************/ BOOL DriverNameToDeviceInst( _In_reads_bytes_(cbDriverName) PCHAR DriverName, _In_ size_t cbDriverName, _Out_ HDEVINFO *pDevInfo, _Out_writes_bytes_(sizeof(SP_DEVINFO_DATA)) PSP_DEVINFO_DATA pDevInfoData ) { HDEVINFO deviceInfo = INVALID_HANDLE_VALUE; BOOL status = TRUE; ULONG deviceIndex; SP_DEVINFO_DATA deviceInfoData; BOOL bResult = FALSE; PCHAR pDriverName = NULL; PSTR buf = NULL; BOOL done = FALSE; if (pDevInfo == NULL) { return FALSE; }
#if defined(EVENT_TRACING) #include "FxObjectKm.tmh" #endif } extern "C" { _Must_inspect_result_ NTSTATUS FxObject::_ObjectQuery( _In_ FxObject* Object, _In_ CONST GUID* Guid, _In_ ULONG QueryBufferLength, _Out_writes_bytes_(QueryBufferLength) PVOID QueryBuffer ) /*++ Routine Description: Query the object handle for specific information This allows dynamic extensions to DDI's. Currently, it is used to allow test hooks for verification which are not available in a production release. Arguments:
{ if (Stream->FinalRelease) Stream->FinalRelease(Stream); } return Result; } /* * @implemented */ HRESULT NTAPI RtlReadMemoryStream( _In_ IStream *This, _Out_writes_bytes_(Length) PVOID Buffer, _In_ ULONG Length, _Out_opt_ PULONG BytesRead) { ULONG CopyLength; PRTL_MEMORY_STREAM Stream = IStream_To_RTL_MEMORY_STREAM(This); SIZE_T Available = (PUCHAR)Stream->End - (PUCHAR)Stream->Current; if (BytesRead) *BytesRead = 0; if (!Length) return S_OK; CopyLength = min(Available, Length);
#ifdef ALLOC_PRAGMA #pragma alloc_text(PAGE, GetStackCapability) #if (NTDDI_VERSION >= NTDDI_WIN8) #pragma alloc_text(PAGE, InitializePipeContextForSuperSpeedBulkPipe) #endif #endif NTSTATUS GetStackCapability( _In_ WDFDEVICE Device, _In_ const GUID* CapabilityType, _In_ ULONG OutputBufferLength, _When_(OutputBufferLength == 0, _Pre_null_) _When_(OutputBufferLength != 0, _Out_writes_bytes_(OutputBufferLength)) PUCHAR OutputBuffer ) /*++ Routine Description: The helper routine gets stack's capability. Arguments: Device - WDF Device Object CapabilityType - Pointer to capability type GUID OutputBufferLength - Length of output buffer
* Not needed if you're not using NtQueryInformationFile! * * BEGIN */ typedef struct _IO_STATUS_BLOCK { union { NTSTATUS Status; PVOID Pointer; } DUMMYUNIONNAME; ULONG_PTR Information; } IO_STATUS_BLOCK, *PIO_STATUS_BLOCK; NTSYSCALLAPI NTSTATUS NTAPI NtQueryInformationFile( _In_ HANDLE FileHandle, _Out_ PIO_STATUS_BLOCK IoStatusBlock, _Out_writes_bytes_(Length) PVOID FileInformation, _In_ ULONG Length, _In_ FILE_INFORMATION_CLASS FileInformationClass); /** * END */ NTSTATUS DOKAN_CALLBACK MirrorFindStreams(LPCWSTR FileName, PFillFindStreamData FillFindStreamData, PDOKAN_FILE_INFO DokanFileInfo) { WCHAR filePath[MAX_PATH]; HANDLE hFind; WIN32_FIND_STREAM_DATA findData; DWORD error; int count = 0; GetFilePath(filePath, MAX_PATH, FileName);
m_PartialFrame = NULL; m_PartialFrameBytes = 0; } } // // Init a new frame. // Note: caller will save and restore the floatingpoint state. // #pragma warning(push) // Caller wraps this routine between KeSaveFloatingPointState/KeRestoreFloatingPointState calls. #pragma warning(disable: 28110) VOID ToneGenerator::InitNewFrame ( _Out_writes_bytes_(FrameSize) BYTE* Frame, _In_ DWORD FrameSize ) { double sinValue = TONE_AMPLITUDE * sin( m_Theta ); if (FrameSize != (DWORD)m_ChannelCount * m_BitsPerSample/8) { ASSERT(FALSE); RtlZeroMemory(Frame, FrameSize); return; } for(ULONG i = 0; i < m_ChannelCount; ++i) { if (m_BitsPerSample == 8)
* pdwActualData - receives the number of bytes actually written to pOutData * * Return Value: * * If the operation succeeds, the method must return S_OK. Otherwise, it * should return one of the STIERR-prefixed error codes defined in stierr.h * or another standard COM error code. This driver returns STIERR_UNSUPPORTED. * \**************************************************************************/ HRESULT CWiaDriver::Escape( STI_RAW_CONTROL_CODE EscapeFunction, _In_reads_bytes_(cbInDataSize) LPVOID lpInData, DWORD cbInDataSize, _Out_writes_bytes_(cbOutDataSize) LPVOID pOutData, DWORD cbOutDataSize, _Out_ LPDWORD pdwActualData) { UNREFERENCED_PARAMETER(EscapeFunction); UNREFERENCED_PARAMETER(cbInDataSize); UNREFERENCED_PARAMETER(lpInData); UNREFERENCED_PARAMETER(cbOutDataSize); UNREFERENCED_PARAMETER(pOutData); WIAEX_ERROR((g_hInst, "This method is not implemented or supported for this driver")); HRESULT hr = STIERR_UNSUPPORTED; if (pdwActualData)
Status = QueryFileInfo(FileHandle, (PVOID*)&FileAllInfo, &Length, FileAllInformation); ok_eq_hex(Status, STATUS_SUCCESS); ok_eq_size(Length, FIELD_OFFSET(FILE_ALL_INFORMATION, NameInformation.FileName) + NameLength); if (FileAllInfo) KmtFreeGuarded(FileAllInfo); ExFreePoolWithTag(Name, 'sFmK'); Status = ObCloseHandle(FileHandle, KernelMode); ok_eq_hex(Status, STATUS_SUCCESS); } static VOID Substitute( _Out_writes_bytes_(BufferSize) PWCHAR Buffer, _In_ ULONG BufferSize, _In_ PCWSTR Template, _In_ PCWSTR SystemDriveName, _In_ PCWSTR SystemRootName) { UNICODE_STRING SystemDriveTemplate = RTL_CONSTANT_STRING(L"C:"); UNICODE_STRING SystemRootTemplate = RTL_CONSTANT_STRING(L"ReactOS"); ULONG SystemDriveLength; ULONG SystemRootLength; PWCHAR Dest = Buffer; UNICODE_STRING String; SystemDriveLength = wcslen(SystemDriveName) * sizeof(WCHAR); SystemRootLength = wcslen(SystemRootName) * sizeof(WCHAR);
int main(const int argc, const char* const argv[]) { HMODULE hMicroDriver = LoadLibrary(L"hpgtmcro.dll"); HRESULT (__stdcall* pMicroEntry)(LONG lCommand, _Inout_ PVAL pValue); HRESULT(__stdcall* pScan)(_Inout_ PSCANINFO pScanInfo, LONG lPhase, _Out_writes_bytes_(lLength) PBYTE pBuffer, LONG lLength, _Out_ LONG *plReceived); HRESULT(__stdcall* pSetPixelWindow)(_Inout_ PSCANINFO pScanInfo, LONG x, LONG y, LONG xExtent, LONG yExtent); pMicroEntry = reinterpret_cast<decltype(pMicroEntry)>(GetProcAddress(hMicroDriver, "MicroEntry")); pScan = reinterpret_cast<decltype(pScan)>(GetProcAddress(hMicroDriver, "Scan")); pSetPixelWindow = reinterpret_cast<decltype(pSetPixelWindow)>(GetProcAddress(hMicroDriver, "SetPixelWindow")); HKEY hRegKey; //DeviceData\TulipCLSID value in this key must be {F20FB4D8-0C85-454B-AA3F-4F0E803A0E5D} //0000 assumes the 3300C is the first scanner. if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\Class\\{6bdd1fc6-810f-11d0-bec7-08002be2092f}\\0000", 0, KEY_READ, &hRegKey) != ERROR_SUCCESS) { int a = 0; a++; } //Usbscan0 assumes the 3300C is the first scanner. const HANDLE hScanner = CreateFile(L"\\\\.\\Usbscan0", GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, 0, NULL); SCANINFO ScanInfo = {}; ScanInfo.DeviceIOHandles[0] = hScanner; VAL Val = {}; Val.pScanInfo = &ScanInfo; Val.pHandle = reinterpret_cast<HANDLE*>(&hRegKey); HRESULT Result = 0; Result = pMicroEntry(CMD_SETSTIDEVICEHKEY, &Val); Result = pMicroEntry(CMD_INITIALIZE, &Val); const LONG iRes = 300; Val.lVal = 300; Result = pMicroEntry(CMD_SETXRESOLUTION, &Val); Result = pMicroEntry(CMD_SETYRESOLUTION, &Val); const LONG iSizeX = iRes*ScanInfo.BedWidth / 1000; const LONG iSizeY = iRes*ScanInfo.BedHeight / 1000; Result = pSetPixelWindow(&ScanInfo, 0, 0, iSizeX, iSizeY); LONG iReceived; std::vector<BYTE> Buffer; const size_t iBytesPerPixel = 3; const size_t iBufSize = iSizeX * iSizeY * iBytesPerPixel; const size_t iNumLinesPerCall = 8; const size_t iDataPerCall = iSizeX * iNumLinesPerCall * iBytesPerPixel; const size_t iNumCalls = (iSizeY + iNumLinesPerCall - 1) / iNumLinesPerCall; Buffer.resize(iBufSize); std::vector<BYTE> Buffer2; Buffer2.resize(iBufSize); size_t iDataLeft = iBufSize; for (size_t i = 0; i < iNumCalls; i++, iDataLeft -= iDataPerCall) { const size_t iSize = min(iDataLeft, iDataPerCall); pScan(&ScanInfo, i == 0 ? SCAN_FIRST : SCAN_NEXT, &Buffer[i*iDataPerCall], iSize, &iReceived); } pScan(&ScanInfo, SCAN_FINISHED, nullptr, 0, nullptr); Result = pScan(&ScanInfo, SCAN_FINISHED, Buffer.data(), iBufSize, &iReceived); Result = pMicroEntry(CMD_UNINITIALIZE, &Val); RegCloseKey(hRegKey); CloseHandle(hScanner); FreeLibrary(hMicroDriver); FILE* f; fopen_s(&f, "dump.raw", "wb"); fwrite(Buffer.data(), Buffer.size(), 1, f); fclose(f); }
UNIMPLEMENTED; } /* * @implemented */ STORPORT_API ULONG NTAPI StorPortGetBusData( _In_ PVOID DeviceExtension, _In_ ULONG BusDataType, _In_ ULONG SystemIoBusNumber, _In_ ULONG SlotNumber, _Out_ _When_(Length != 0, _Out_writes_bytes_(Length)) PVOID Buffer, _In_ ULONG Length) { PMINIPORT_DEVICE_EXTENSION MiniportExtension; PBUS_INTERFACE_STANDARD Interface; ULONG ReturnLength; DPRINT1("StorPortGetBusData(%p %lu %lu %lu %p %lu)\n", DeviceExtension, BusDataType, SystemIoBusNumber, SlotNumber, Buffer, Length); /* Get the miniport extension */ MiniportExtension = CONTAINING_RECORD(DeviceExtension, MINIPORT_DEVICE_EXTENSION, HwDeviceExtension); DPRINT1("DeviceExtension %p MiniportExtension %p\n", DeviceExtension, MiniportExtension);
// // Now update the filename portion of the name. // CdName->FileName.Length = (USHORT) NameLength; return; } VOID CdConvertBigToLittleEndian ( _In_ PIRP_CONTEXT IrpContext, _In_reads_bytes_(ByteCount) PCHAR BigEndian, _In_ ULONG ByteCount, _Out_writes_bytes_(ByteCount) PCHAR LittleEndian ) /*++ Routine Description: This routine is called to convert a unicode string in big endian to little endian. We start by copying all of the source bytes except the first. This will put the low order bytes in the correct position. We then copy each high order byte in its correct position. Arguments: BigEndian - Pointer to the string of big endian characters.