Module: ReservedNames::Win32::API::Macros

Defined in:
lib/chef/win32/api.rb

Instance Method Summary collapse

Instance Method Details

#FAILED(status) ⇒ Object



341
342
343
# File 'lib/chef/win32/api.rb', line 341

def FAILED(status)
  status < 0
end

#HIBYTE(w) ⇒ Object

Retrieves the high-order byte from the given 16-bit value.

msdn.microsoft.com/en-us/library/windows/desktop/ms632656(v=VS.85).aspx



297
298
299
# File 'lib/chef/win32/api.rb', line 297

def HIBYTE(w)
  w >> 8
end

#HIWORD(l) ⇒ Object

Retrieves the high-order word from the specified 32-bit value.

msdn.microsoft.com/en-us/library/windows/desktop/ms632657(v=VS.85).aspx



283
284
285
# File 'lib/chef/win32/api.rb', line 283

def HIWORD(l)
  l >> 16
end

#HRESULT_CODE(hr) ⇒ Object



317
318
319
# File 'lib/chef/win32/api.rb', line 317

def HRESULT_CODE(hr)
  hr & 0xFFFF
end

#HRESULT_FACILITY(hr) ⇒ Object



321
322
323
# File 'lib/chef/win32/api.rb', line 321

def HRESULT_FACILITY(hr)
  (hr >> 16) & 0x1fff
end

#HRESULT_FROM_NT(x) ⇒ Object



325
326
327
# File 'lib/chef/win32/api.rb', line 325

def HRESULT_FROM_NT(x)
  x | 0x10000000 # FACILITY_NT_BIT
end

#HRESULT_FROM_WIN32(x) ⇒ Object



329
330
331
332
333
334
335
# File 'lib/chef/win32/api.rb', line 329

def HRESULT_FROM_WIN32(x)
  if x <= 0
    x
  else
    (x & 0x0000FFFF) | (7 << 16) | 0x80000000
  end
end

#HRESULT_SEVERITY(hr) ⇒ Object



337
338
339
# File 'lib/chef/win32/api.rb', line 337

def HRESULT_SEVERITY(hr)
  (hr >> 31) & 0x1
end

#IS_ERROR(status) ⇒ Object

winerror.h



305
306
307
# File 'lib/chef/win32/api.rb', line 305

def IS_ERROR(status)
  status >> 31 == 1
end

#LOBYTE(w) ⇒ Object

Retrieves the low-order byte from the specified value.

msdn.microsoft.com/en-us/library/windows/desktop/ms632658(v=VS.85).aspx



290
291
292
# File 'lib/chef/win32/api.rb', line 290

def LOBYTE(w)
  w & 0xff
end

#LocalDiscard(pointer) ⇒ Object

winbase.h



251
252
253
# File 'lib/chef/win32/api.rb', line 251

def LocalDiscard(pointer)
  LocalReAlloc(pointer, 0, LMEM_MOVEABLE)
end

#LOWORD(l) ⇒ Object

Retrieves the low-order word from the specified value.

msdn.microsoft.com/en-us/library/windows/desktop/ms632659(v=VS.85).aspx



276
277
278
# File 'lib/chef/win32/api.rb', line 276

def LOWORD(l)
  l & 0xffff
end

#MAKE_HRESULT(sev, fac, code) ⇒ Object



309
310
311
# File 'lib/chef/win32/api.rb', line 309

def MAKE_HRESULT(sev, fac, code)
  sev << 31 | fac << 16 | code
end

#MAKE_SCODE(sev, fac, code) ⇒ Object



313
314
315
# File 'lib/chef/win32/api.rb', line 313

def MAKE_SCODE(sev, fac, code)
  sev << 31 | fac << 16 | code
end

#MAKELONG(low, high) ⇒ Object

Creates a LONG value by concatenating the specified values.

msdn.microsoft.com/en-us/library/windows/desktop/ms632660(v=vs.85).aspx



269
270
271
# File 'lib/chef/win32/api.rb', line 269

def MAKELONG(low, high)
  ((low & 0xffff) | (high & 0xffff)) << 16
end

#MAKEWORD(low, high) ⇒ Object

Creates a WORD value by concatenating the specified values.

msdn.microsoft.com/en-us/library/windows/desktop/ms632663(v=VS.85).aspx



262
263
264
# File 'lib/chef/win32/api.rb', line 262

def MAKEWORD(low, high)
  ((low & 0xff) | (high & 0xff)) << 8
end

#SUCCEEDED(status) ⇒ Object



345
346
347
# File 'lib/chef/win32/api.rb', line 345

def SUCCEEDED(status)
  status >= 0
end