本文整理汇总了C++中ULongToPtr函数的典型用法代码示例。如果您正苦于以下问题:C++ ULongToPtr函数的具体用法?C++ ULongToPtr怎么用?C++ ULongToPtr使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ULongToPtr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: KiSignalTimer
BOOLEAN
FASTCALL
KiSignalTimer(IN PKTIMER Timer)
{
BOOLEAN RequestInterrupt = FALSE;
PKDPC Dpc = Timer->Dpc;
ULONG Period = Timer->Period;
LARGE_INTEGER Interval, SystemTime;
DPRINT("KiSignalTimer(): Timer %p\n", Timer);
/* Set default values */
Timer->Header.Inserted = FALSE;
Timer->Header.SignalState = TRUE;
/* Check if the timer has waiters */
if (!IsListEmpty(&Timer->Header.WaitListHead))
{
/* Check the type of event */
if (Timer->Header.Type == TimerNotificationObject)
{
/* Unwait the thread */
KxUnwaitThread(&Timer->Header, IO_NO_INCREMENT);
}
else
{
/* Otherwise unwait the thread and signal the timer */
KxUnwaitThreadForEvent((PKEVENT)Timer, IO_NO_INCREMENT);
}
}
/* Check if we have a period */
if (Period)
{
/* Calculate the interval and insert the timer */
Interval.QuadPart = Int32x32To64(Period, -10000);
while (!KiInsertTreeTimer(Timer, Interval));
}
/* Check if we have a DPC */
if (Dpc)
{
/* Insert it in the queue */
KeQuerySystemTime(&SystemTime);
KeInsertQueueDpc(Dpc,
ULongToPtr(SystemTime.LowPart),
ULongToPtr(SystemTime.HighPart));
RequestInterrupt = TRUE;
}
/* Return whether we need to request a DPC interrupt or not */
return RequestInterrupt;
}
示例2: rb_WriteConsoleOutput
VALUE
rb_WriteConsoleOutput(VALUE self, VALUE h, VALUE buffer,
VALUE srcwid, VALUE srcht, VALUE startx,
VALUE starty, VALUE l, VALUE t, VALUE r, VALUE b)
{
COORD coords;
COORD size;
SMALL_RECT to;
HANDLE handle = ULongToPtr( NUM2ULONG( h ) );
Check_Type( buffer, T_STRING );
size.X=NUM2UINT( srcwid );
size.Y=NUM2UINT( srcht );
coords.X=NUM2INT( startx );
coords.Y=NUM2INT( starty );
to.Left = NUM2INT( l );
to.Top = NUM2INT( t );
to.Right = NUM2INT( r );
to.Bottom = NUM2INT( b );
if (WriteConsoleOutput(handle,(CHAR_INFO *)RSTRING_PTR(buffer),
size,coords,&to)) {
VALUE ret = rb_ary_new();
rb_ary_push( ret, INT2FIX( to.Left ) );
rb_ary_push( ret, INT2FIX( to.Top ) );
rb_ary_push( ret, INT2FIX( to.Right ) );
rb_ary_push( ret, INT2FIX( to.Bottom ) );
return ret;
}
return rb_getWin32Error();
}
示例3: rb_WriteConsoleOutputAttribute
VALUE
rb_WriteConsoleOutputAttribute(VALUE self, VALUE h, VALUE s,
VALUE x, VALUE y)
{
unsigned short buffer[80*999*sizeof(unsigned short)];
HANDLE handle = ULongToPtr( NUM2ULONG( h ) );
DWORD written;
DWORD towrite;
unsigned i = 0;
COORD coords;
Check_Type( s, T_STRING );
towrite = RSTRING_LEN(s);
for(i=0; i<towrite; i++) {
buffer[i] = (unsigned short)(RSTRING_PTR(s)[i]);
}
coords.X=NUM2INT( x );
coords.Y=NUM2INT( y );
if (WriteConsoleOutputAttribute(handle,(const unsigned short *)&buffer,
towrite,coords,&written)) {
return UINT2NUM( written );
}
return rb_getWin32Error();
}
示例4: rb_GetConsoleScreenBufferInfo
static VALUE rb_GetConsoleScreenBufferInfo( VALUE self, VALUE hConsoleOutput )
{
VALUE ret = rb_ary_new();
HANDLE handle = ULongToPtr( NUM2ULONG( hConsoleOutput ) );
CONSOLE_SCREEN_BUFFER_INFO out;
if ( !GetConsoleScreenBufferInfo( handle, &out ) )
return rb_getWin32Error();
rb_ary_push( ret, UINT2NUM( out.dwSize.X ) );
rb_ary_push( ret, UINT2NUM( out.dwSize.Y ) );
rb_ary_push( ret, UINT2NUM( out.dwCursorPosition.X ) );
rb_ary_push( ret, UINT2NUM( out.dwCursorPosition.Y ) );
rb_ary_push( ret, UINT2NUM( out.wAttributes ) );
rb_ary_push( ret, INT2FIX( out.srWindow.Left ) );
rb_ary_push( ret, INT2FIX( out.srWindow.Top ) );
rb_ary_push( ret, INT2FIX( out.srWindow.Right ) );
rb_ary_push( ret, INT2FIX( out.srWindow.Bottom ) );
rb_ary_push( ret, UINT2NUM( out.dwMaximumWindowSize.X ) );
rb_ary_push( ret, UINT2NUM( out.dwMaximumWindowSize.Y ) );
return ret;
}
示例5: MCIAVI_CreateWindow
BOOL MCIAVI_CreateWindow(WINE_MCIAVI* wma, DWORD dwFlags, LPMCI_DGV_OPEN_PARMSW lpOpenParms)
{
static const WCHAR captionW[] = {'W','i','n','e',' ','M','C','I','-','A','V','I',' ','p','l','a','y','e','r',0};
HWND hParent = 0;
DWORD dwStyle = WS_OVERLAPPEDWINDOW;
RECT rc;
/* what should be done ? */
if (wma->hWnd) return TRUE;
if (dwFlags & MCI_DGV_OPEN_PARENT) hParent = lpOpenParms->hWndParent;
if (dwFlags & MCI_DGV_OPEN_WS) dwStyle = lpOpenParms->dwStyle;
rc.left = rc.top = 0;
rc.right = (wma->hic ? wma->outbih : wma->inbih)->biWidth;
rc.bottom = (wma->hic ? wma->outbih : wma->inbih)->biHeight;
AdjustWindowRect(&rc, dwStyle, FALSE);
if (!(dwStyle & (WS_CHILD|WS_POPUP))) /* overlapped window ? */
{
rc.right -= rc.left;
rc.bottom -= rc.top;
rc.left = rc.top = CW_USEDEFAULT;
}
wma->hWnd = CreateWindowW(mciaviW, captionW,
dwStyle, rc.left, rc.top,
rc.right, rc.bottom,
hParent, 0, MCIAVI_hInstance,
ULongToPtr(wma->wDevID));
wma->hWndPaint = wma->hWnd;
return wma->hWnd != 0;
}
示例6: rb_ReadConsoleOutput
static VALUE rb_ReadConsoleOutput( VALUE self, VALUE hConsoleOutput,
VALUE buffer, VALUE srcwid, VALUE srcht,
VALUE startx, VALUE starty,
VALUE l, VALUE t, VALUE r, VALUE b )
{
VALUE ret = rb_ary_new();
COORD coords;
COORD size;
SMALL_RECT from;
HANDLE handle = ULongToPtr( NUM2ULONG( hConsoleOutput ) );
size.X= NUM2UINT( srcwid );
size.Y= NUM2UINT( srcht );
coords.X= NUM2INT( startx );
coords.Y= NUM2INT( starty );
from.Left = NUM2INT( l );
from.Top = NUM2INT( t );
from.Right = NUM2INT( r );
from.Bottom = NUM2INT( b );
Check_Type( buffer, T_STRING );
if ( (unsigned long)RSTRING_LEN(buffer) < (sizeof(CHAR_INFO)*size.X*size.Y) )
rb_raise(rb_eArgError, "string buffer is too small for reading that many characters.");
if (!ReadConsoleOutput(handle,(CHAR_INFO *)RSTRING_PTR(buffer),size,coords,&from))
return rb_getWin32Error();
rb_ary_push( ret, INT2FIX(from.Left) );
rb_ary_push( ret, INT2FIX(from.Top) );
rb_ary_push( ret, INT2FIX(from.Right) );
rb_ary_push( ret, INT2FIX(from.Bottom) );
return ret;
}
示例7: rb_ScrollConsoleScreenBuffer
VALUE
rb_ScrollConsoleScreenBuffer( VALUE self, VALUE hConsoleOutput, VALUE left1,
VALUE top1, VALUE right1, VALUE bottom1,
VALUE col, VALUE row, VALUE cChar, VALUE attr,
VALUE left2, VALUE top2, VALUE right2,
VALUE bottom2)
{
HANDLE handle = ULongToPtr( NUM2ULONG( hConsoleOutput ) );
CHAR_INFO fill;
COORD origin;
SMALL_RECT scroll, clip;
scroll.Left = NUM2INT( left1 );
scroll.Right = NUM2INT( right1 );
scroll.Top = NUM2INT( top1 );
scroll.Bottom = NUM2INT( bottom1 );
clip.Left = NUM2INT( left2 );
clip.Right = NUM2INT( right2 );
clip.Top = NUM2INT( top2 );
clip.Bottom = NUM2INT( bottom2 );
#ifdef UNICODE
fill.Char.UnicodeChar = NUM2CHR( cChar );
#else
fill.Char.AsciiChar = NUM2CHR( cChar );
#endif
fill.Attributes = NUM2INT(attr);
origin.X = NUM2UINT( col );
origin.Y = NUM2UINT( row );
if ( ScrollConsoleScreenBuffer( handle, &scroll, &clip, origin,
&fill ) )
return INT2FIX(1);
return rb_getWin32Error();
}
示例8: rb_SetStdHandle
VALUE
rb_SetStdHandle( VALUE self, VALUE fd, VALUE hConsoleOutput )
{
HANDLE handle = ULongToPtr( NUM2ULONG( hConsoleOutput ) );
if (SetStdHandle(NUM2UINT(fd), handle))
return NUM2UINT(1);
return rb_getWin32Error();
}
示例9: rb_SetConsoleMode
static VALUE rb_SetConsoleMode( VALUE self, VALUE hConsoleOutput,
VALUE Mode )
{
HANDLE handle = ULongToPtr( NUM2ULONG( hConsoleOutput ) );
if ( SetConsoleMode( handle, NUM2UINT( Mode ) ) )
return INT2FIX(1);
return rb_getWin32Error();
}
示例10: rb_GetConsoleMode
static VALUE rb_GetConsoleMode(VALUE self, VALUE hConsoleOutput)
{
HANDLE handle = ULongToPtr( NUM2ULONG( hConsoleOutput ) );
DWORD mode;
if (GetConsoleMode(handle,&mode))
return UINT2NUM(mode);
return rb_getWin32Error();
}
示例11: rb_GetNumberOfConsoleInputEvents
static VALUE rb_GetNumberOfConsoleInputEvents( VALUE self, VALUE hConsoleOutput )
{
HANDLE handle = ULongToPtr( NUM2ULONG( hConsoleOutput ) );
DWORD events;
if (GetNumberOfConsoleInputEvents(handle, &events))
return INT2FIX(events);
return rb_getWin32Error();
}
示例12: rb_SetConsoleActiveScreenBuffer
VALUE
rb_SetConsoleActiveScreenBuffer( VALUE self, VALUE hConsoleOutput )
{
HANDLE handle = ULongToPtr( NUM2ULONG( hConsoleOutput ) );
if ( !SetConsoleActiveScreenBuffer( handle ) )
return rb_getWin32Error();
return INT2FIX(1);
}
示例13: rb_SetConsoleTextAttribute
VALUE
rb_SetConsoleTextAttribute( VALUE self, VALUE hConsoleOutput,
VALUE wAttributes )
{
HANDLE handle = ULongToPtr( NUM2ULONG( hConsoleOutput ) );
if ( !SetConsoleTextAttribute( handle, NUM2UINT(wAttributes) ) )
return Qnil; // no getWin32Error to allow piping/redirecting
return INT2FIX(1);
}
示例14: rb_GetLargestConsoleWindowSize
static VALUE rb_GetLargestConsoleWindowSize( VALUE self, VALUE hConsoleOutput )
{
HANDLE handle = ULongToPtr( NUM2ULONG( hConsoleOutput ) );
COORD size = GetLargestConsoleWindowSize( handle);
VALUE ret = rb_ary_new();
rb_ary_push( ret, UINT2NUM( size.X ) );
rb_ary_push( ret, UINT2NUM( size.Y ) );
return ret;
}
示例15: rb_SetConsoleCursorInfo
VALUE
rb_SetConsoleCursorInfo( VALUE self, VALUE hConsoleOutput,
VALUE size, VALUE visib )
{
HANDLE handle = ULongToPtr( NUM2ULONG( hConsoleOutput ) );
CONSOLE_CURSOR_INFO c;
c.dwSize = NUM2UINT(size);
c.bVisible = NUM2UINT(visib);
if ( !SetConsoleCursorInfo( handle, &c ) )
return rb_getWin32Error();
return INT2FIX(1);
}