How to use win32 method in Webdriverio

Best JavaScript code snippet using webdriverio-monorepo

enigmailprocess_shared_win.js

Source:enigmailprocess_shared_win.js Github

copy

Full Screen

1/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */2/* vim: set sts=2 sw=2 et tw=80: */3/* This Source Code Form is subject to the terms of the Mozilla Public4 * License, v. 2.0. If a copy of the MPL was not distributed with this5 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */6"use strict";7/* exported LIBC, Win, createPipe, libc */8/* global ctypes: false, OS: false, Library: false */9/* eslint no-void: 0 */10const LIBC = OS.Constants.libc;11const Win = OS.Constants.Win;12const LIBC_CHOICES = ["kernel32.dll"];13var win32 = {14 // On Windows 64, winapi_abi is an alias for default_abi.15 WINAPI: ctypes.winapi_abi,16 VOID: ctypes.void_t,17 BYTE: ctypes.uint8_t,18 WORD: ctypes.uint16_t,19 DWORD: ctypes.uint32_t,20 LONG: ctypes.long,21 LARGE_INTEGER: ctypes.int64_t,22 ULONGLONG: ctypes.uint64_t,23 UINT: ctypes.unsigned_int,24 UCHAR: ctypes.unsigned_char,25 BOOL: ctypes.bool,26 HANDLE: ctypes.voidptr_t,27 PVOID: ctypes.voidptr_t,28 LPVOID: ctypes.voidptr_t,29 CHAR: ctypes.char,30 WCHAR: ctypes.jschar,31 ULONG_PTR: ctypes.uintptr_t,32 SIZE_T: ctypes.size_t,33 PSIZE_T: ctypes.size_t.ptr34};35Object.assign(win32, {36 DWORD_PTR: win32.ULONG_PTR,37 LPSTR: win32.CHAR.ptr,38 LPWSTR: win32.WCHAR.ptr,39 LPBYTE: win32.BYTE.ptr,40 LPDWORD: win32.DWORD.ptr,41 LPHANDLE: win32.HANDLE.ptr,42 // This is an opaque type.43 PROC_THREAD_ATTRIBUTE_LIST: ctypes.char.array(),44 LPPROC_THREAD_ATTRIBUTE_LIST: ctypes.char.ptr45});46Object.assign(win32, {47 LPCSTR: win32.LPSTR,48 LPCWSTR: win32.LPWSTR,49 LPCVOID: win32.LPVOID50});51Object.assign(win32, {52 INVALID_HANDLE_VALUE: ctypes.cast(ctypes.int64_t(-1), win32.HANDLE),53 NULL_HANDLE_VALUE: ctypes.cast(ctypes.uintptr_t(0), win32.HANDLE),54 CREATE_SUSPENDED: 0x00000004,55 CREATE_NEW_CONSOLE: 0x00000010,56 CREATE_UNICODE_ENVIRONMENT: 0x00000400,57 CREATE_NO_WINDOW: 0x08000000,58 CREATE_BREAKAWAY_FROM_JOB: 0x01000000,59 EXTENDED_STARTUPINFO_PRESENT: 0x00080000,60 STARTF_USESTDHANDLES: 0x0100,61 DUPLICATE_CLOSE_SOURCE: 0x01,62 DUPLICATE_SAME_ACCESS: 0x02,63 ERROR_HANDLE_EOF: 38,64 ERROR_BROKEN_PIPE: 109,65 ERROR_INSUFFICIENT_BUFFER: 122,66 FILE_FLAG_OVERLAPPED: 0x40000000,67 PIPE_TYPE_BYTE: 0x00,68 PIPE_ACCESS_INBOUND: 0x01,69 PIPE_ACCESS_OUTBOUND: 0x02,70 PIPE_ACCESS_DUPLEX: 0x03,71 PIPE_WAIT: 0x00,72 PIPE_NOWAIT: 0x01,73 STILL_ACTIVE: 259,74 PROC_THREAD_ATTRIBUTE_HANDLE_LIST: 0x00020002,75 JobObjectBasicLimitInformation: 2,76 JobObjectExtendedLimitInformation: 9,77 JOB_OBJECT_LIMIT_BREAKAWAY_OK: 0x00000800,78 // These constants are 32-bit unsigned integers, but Windows defines79 // them as negative integers cast to an unsigned type.80 STD_INPUT_HANDLE: -10 + 0x100000000,81 STD_OUTPUT_HANDLE: -11 + 0x100000000,82 STD_ERROR_HANDLE: -12 + 0x100000000,83 WAIT_TIMEOUT: 0x00000102,84 WAIT_FAILED: 0xffffffff85});86Object.assign(win32, {87 JOBOBJECT_BASIC_LIMIT_INFORMATION: new ctypes.StructType("JOBOBJECT_BASIC_LIMIT_INFORMATION", [{88 "PerProcessUserTimeLimit": win32.LARGE_INTEGER89 }, {90 "PerJobUserTimeLimit": win32.LARGE_INTEGER91 }, {92 "LimitFlags": win32.DWORD93 }, {94 "MinimumWorkingSetSize": win32.SIZE_T95 }, {96 "MaximumWorkingSetSize": win32.SIZE_T97 }, {98 "ActiveProcessLimit": win32.DWORD99 }, {100 "Affinity": win32.ULONG_PTR101 }, {102 "PriorityClass": win32.DWORD103 }, {104 "SchedulingClass": win32.DWORD105 }]),106 IO_COUNTERS: new ctypes.StructType("IO_COUNTERS", [{107 "ReadOperationCount": win32.ULONGLONG108 }, {109 "WriteOperationCount": win32.ULONGLONG110 }, {111 "OtherOperationCount": win32.ULONGLONG112 }, {113 "ReadTransferCount": win32.ULONGLONG114 }, {115 "WriteTransferCount": win32.ULONGLONG116 }, {117 "OtherTransferCount": win32.ULONGLONG118 }])119});120Object.assign(win32, {121 JOBOBJECT_EXTENDED_LIMIT_INFORMATION: new ctypes.StructType("JOBOBJECT_EXTENDED_LIMIT_INFORMATION", [{122 "BasicLimitInformation": win32.JOBOBJECT_BASIC_LIMIT_INFORMATION123 }, {124 "IoInfo": win32.IO_COUNTERS125 }, {126 "ProcessMemoryLimit": win32.SIZE_T127 }, {128 "JobMemoryLimit": win32.SIZE_T129 }, {130 "PeakProcessMemoryUsed": win32.SIZE_T131 }, {132 "PeakJobMemoryUsed": win32.SIZE_T133 }]),134 OVERLAPPED: new ctypes.StructType("OVERLAPPED", [{135 "Internal": win32.ULONG_PTR136 }, {137 "InternalHigh": win32.ULONG_PTR138 }, {139 "Offset": win32.DWORD140 }, {141 "OffsetHigh": win32.DWORD142 }, {143 "hEvent": win32.HANDLE144 }]),145 PROCESS_INFORMATION: new ctypes.StructType("PROCESS_INFORMATION", [{146 "hProcess": win32.HANDLE147 }, {148 "hThread": win32.HANDLE149 }, {150 "dwProcessId": win32.DWORD151 }, {152 "dwThreadId": win32.DWORD153 }]),154 SECURITY_ATTRIBUTES: new ctypes.StructType("SECURITY_ATTRIBUTES", [{155 "nLength": win32.DWORD156 }, {157 "lpSecurityDescriptor": win32.LPVOID158 }, {159 "bInheritHandle": win32.BOOL160 }]),161 STARTUPINFOW: new ctypes.StructType("STARTUPINFOW", [{162 "cb": win32.DWORD163 }, {164 "lpReserved": win32.LPWSTR165 }, {166 "lpDesktop": win32.LPWSTR167 }, {168 "lpTitle": win32.LPWSTR169 }, {170 "dwX": win32.DWORD171 }, {172 "dwY": win32.DWORD173 }, {174 "dwXSize": win32.DWORD175 }, {176 "dwYSize": win32.DWORD177 }, {178 "dwXCountChars": win32.DWORD179 }, {180 "dwYCountChars": win32.DWORD181 }, {182 "dwFillAttribute": win32.DWORD183 }, {184 "dwFlags": win32.DWORD185 }, {186 "wShowWindow": win32.WORD187 }, {188 "cbReserved2": win32.WORD189 }, {190 "lpReserved2": win32.LPBYTE191 }, {192 "hStdInput": win32.HANDLE193 }, {194 "hStdOutput": win32.HANDLE195 }, {196 "hStdError": win32.HANDLE197 }])198});199Object.assign(win32, {200 STARTUPINFOEXW: new ctypes.StructType("STARTUPINFOEXW", [{201 "StartupInfo": win32.STARTUPINFOW202 }, {203 "lpAttributeList": win32.LPPROC_THREAD_ATTRIBUTE_LIST204 }])205});206var libc = new Library("libc", LIBC_CHOICES, {207 AssignProcessToJobObject: [208 win32.WINAPI,209 win32.BOOL,210 win32.HANDLE, /* hJob */211 win32.HANDLE /* hProcess */212 ],213 CloseHandle: [214 win32.WINAPI,215 win32.BOOL,216 win32.HANDLE /* hObject */217 ],218 CreateEventW: [219 win32.WINAPI,220 win32.HANDLE,221 win32.SECURITY_ATTRIBUTES.ptr, /* opt lpEventAttributes */222 win32.BOOL, /* bManualReset */223 win32.BOOL, /* bInitialState */224 win32.LPWSTR /* lpName */225 ],226 CreateFileW: [227 win32.WINAPI,228 win32.HANDLE,229 win32.LPWSTR, /* lpFileName */230 win32.DWORD, /* dwDesiredAccess */231 win32.DWORD, /* dwShareMode */232 win32.SECURITY_ATTRIBUTES.ptr, /* opt lpSecurityAttributes */233 win32.DWORD, /* dwCreationDisposition */234 win32.DWORD, /* dwFlagsAndAttributes */235 win32.HANDLE /* opt hTemplateFile */236 ],237 CreateJobObjectW: [238 win32.WINAPI,239 win32.HANDLE,240 win32.SECURITY_ATTRIBUTES.ptr, /* opt lpJobAttributes */241 win32.LPWSTR /* lpName */242 ],243 CreateNamedPipeW: [244 win32.WINAPI,245 win32.HANDLE,246 win32.LPWSTR, /* lpName */247 win32.DWORD, /* dwOpenMode */248 win32.DWORD, /* dwPipeMode */249 win32.DWORD, /* nMaxInstances */250 win32.DWORD, /* nOutBufferSize */251 win32.DWORD, /* nInBufferSize */252 win32.DWORD, /* nDefaultTimeOut */253 win32.SECURITY_ATTRIBUTES.ptr /* opt lpSecurityAttributes */254 ],255 CreatePipe: [256 win32.WINAPI,257 win32.BOOL,258 win32.LPHANDLE, /* out hReadPipe */259 win32.LPHANDLE, /* out hWritePipe */260 win32.SECURITY_ATTRIBUTES.ptr, /* opt lpPipeAttributes */261 win32.DWORD /* nSize */262 ],263 CreateProcessW: [264 win32.WINAPI,265 win32.BOOL,266 win32.LPCWSTR, /* lpApplicationName */267 win32.LPWSTR, /* lpCommandLine */268 win32.SECURITY_ATTRIBUTES.ptr, /* lpProcessAttributes */269 win32.SECURITY_ATTRIBUTES.ptr, /* lpThreadAttributes */270 win32.BOOL, /* bInheritHandle */271 win32.DWORD, /* dwCreationFlags */272 win32.LPVOID, /* opt lpEnvironment */273 win32.LPCWSTR, /* opt lpCurrentDirectory */274 win32.STARTUPINFOW.ptr, /* lpStartupInfo */275 win32.PROCESS_INFORMATION.ptr /* out lpProcessInformation */276 ],277 CreateSemaphoreW: [278 win32.WINAPI,279 win32.HANDLE,280 win32.SECURITY_ATTRIBUTES.ptr, /* opt lpSemaphoreAttributes */281 win32.LONG, /* lInitialCount */282 win32.LONG, /* lMaximumCount */283 win32.LPCWSTR /* opt lpName */284 ],285 DeleteProcThreadAttributeList: [286 win32.WINAPI,287 win32.VOID,288 win32.LPPROC_THREAD_ATTRIBUTE_LIST /* in/out lpAttributeList */289 ],290 DuplicateHandle: [291 win32.WINAPI,292 win32.BOOL,293 win32.HANDLE, /* hSourceProcessHandle */294 win32.HANDLE, /* hSourceHandle */295 win32.HANDLE, /* hTargetProcessHandle */296 win32.LPHANDLE, /* out lpTargetHandle */297 win32.DWORD, /* dwDesiredAccess */298 win32.BOOL, /* bInheritHandle */299 win32.DWORD /* dwOptions */300 ],301 FreeEnvironmentStringsW: [302 win32.WINAPI,303 win32.BOOL,304 win32.LPCWSTR /* lpszEnvironmentBlock */305 ],306 GetCurrentProcess: [307 win32.WINAPI,308 win32.HANDLE309 ],310 GetCurrentProcessId: [311 win32.WINAPI,312 win32.DWORD313 ],314 GetEnvironmentStringsW: [315 win32.WINAPI,316 win32.LPCWSTR317 ],318 GetExitCodeProcess: [319 win32.WINAPI,320 win32.BOOL,321 win32.HANDLE, /* hProcess */322 win32.LPDWORD /* lpExitCode */323 ],324 GetOverlappedResult: [325 win32.WINAPI,326 win32.BOOL,327 win32.HANDLE, /* hFile */328 win32.OVERLAPPED.ptr, /* lpOverlapped */329 win32.LPDWORD, /* lpNumberOfBytesTransferred */330 win32.BOOL /* bWait */331 ],332 GetStdHandle: [333 win32.WINAPI,334 win32.HANDLE,335 win32.DWORD /* nStdHandle */336 ],337 InitializeProcThreadAttributeList: [338 win32.WINAPI,339 win32.BOOL,340 win32.LPPROC_THREAD_ATTRIBUTE_LIST, /* out opt lpAttributeList */341 win32.DWORD, /* dwAttributeCount */342 win32.DWORD, /* dwFlags */343 win32.PSIZE_T /* in/out lpSize */344 ],345 ReadFile: [346 win32.WINAPI,347 win32.BOOL,348 win32.HANDLE, /* hFile */349 win32.LPVOID, /* out lpBuffer */350 win32.DWORD, /* nNumberOfBytesToRead */351 win32.LPDWORD, /* opt out lpNumberOfBytesRead */352 win32.OVERLAPPED.ptr /* opt in/out lpOverlapped */353 ],354 ReleaseSemaphore: [355 win32.WINAPI,356 win32.BOOL,357 win32.HANDLE, /* hSemaphore */358 win32.LONG, /* lReleaseCount */359 win32.LONG.ptr /* opt out lpPreviousCount */360 ],361 ResumeThread: [362 win32.WINAPI,363 win32.DWORD,364 win32.HANDLE /* hThread */365 ],366 SetInformationJobObject: [367 win32.WINAPI,368 win32.BOOL,369 win32.HANDLE, /* hJob */370 ctypes.int, /* JobObjectInfoClass */371 win32.LPVOID, /* lpJobObjectInfo */372 win32.DWORD /* cbJobObjectInfoLengt */373 ],374 TerminateJobObject: [375 win32.WINAPI,376 win32.BOOL,377 win32.HANDLE, /* hJob */378 win32.UINT /* uExitCode */379 ],380 TerminateProcess: [381 win32.WINAPI,382 win32.BOOL,383 win32.HANDLE, /* hProcess */384 win32.UINT /* uExitCode */385 ],386 UpdateProcThreadAttribute: [387 win32.WINAPI,388 win32.BOOL,389 win32.LPPROC_THREAD_ATTRIBUTE_LIST, /* in/out lpAttributeList */390 win32.DWORD, /* dwFlags */391 win32.DWORD_PTR, /* Attribute */392 win32.PVOID, /* lpValue */393 win32.SIZE_T, /* cbSize */394 win32.PVOID, /* out opt lpPreviousValue */395 win32.PSIZE_T /* opt lpReturnSize */396 ],397 WaitForMultipleObjects: [398 win32.WINAPI,399 win32.DWORD,400 win32.DWORD, /* nCount */401 win32.HANDLE.ptr, /* hHandles */402 win32.BOOL, /* bWaitAll */403 win32.DWORD /* dwMilliseconds */404 ],405 WaitForSingleObject: [406 win32.WINAPI,407 win32.DWORD,408 win32.HANDLE, /* hHandle */409 win32.BOOL, /* bWaitAll */410 win32.DWORD /* dwMilliseconds */411 ],412 WriteFile: [413 win32.WINAPI,414 win32.BOOL,415 win32.HANDLE, /* hFile */416 win32.LPCVOID, /* lpBuffer */417 win32.DWORD, /* nNumberOfBytesToRead */418 win32.LPDWORD, /* opt out lpNumberOfBytesWritten */419 win32.OVERLAPPED.ptr /* opt in/out lpOverlapped */420 ]421});422var user32 = new Library("user32", ["user32.dll"], {423 AllowSetForegroundWindow: [424 win32.WINAPI,425 win32.BOOL,426 win32.DWORD /* dwProcessId */427 ]428});429let nextNamedPipeId = 0;430win32.Handle = function(handle) {431 return ctypes.CDataFinalizer(win32.HANDLE(handle), libc.CloseHandle);432};433win32.createPipe = function(secAttr, readFlags = 0, writeFlags = 0, size = 0) {434 readFlags |= win32.PIPE_ACCESS_INBOUND;435 writeFlags |= Win.FILE_ATTRIBUTE_NORMAL;436 if (size == 0) {437 size = 4096;438 }439 let pid = libc.GetCurrentProcessId();440 const pipePrefix = "\\\\.\\Pipe\\SubProcessPipe";441 let pipeName = String.raw `${pipePrefix}.${pid}.${nextNamedPipeId++}`;442 let readHandle = libc.CreateNamedPipeW(443 pipeName, readFlags,444 win32.PIPE_TYPE_BYTE | win32.PIPE_WAIT,445 1, /* number of connections */446 size, /* output buffer size */447 size, /* input buffer size */448 0, /* timeout */449 secAttr.address());450 let isInvalid = handle => String(handle) == String(win32.HANDLE(Win.INVALID_HANDLE_VALUE));451 if (isInvalid(readHandle)) {452 return [];453 }454 let writeHandle = libc.CreateFileW(455 pipeName, Win.GENERIC_WRITE, 0, secAttr.address(),456 Win.OPEN_EXISTING, writeFlags, null);457 if (isInvalid(writeHandle)) {458 libc.CloseHandle(readHandle);459 return [];460 }461 return [win32.Handle(readHandle),462 win32.Handle(writeHandle)463 ];464};465win32.createThreadAttributeList = function(handles) {466 try {467 void libc.InitializeProcThreadAttributeList;468 void libc.DeleteProcThreadAttributeList;469 void libc.UpdateProcThreadAttribute;470 } catch (e) {471 // This is only supported in Windows Vista and later.472 return null;473 }474 let size = win32.SIZE_T();475 if (!libc.InitializeProcThreadAttributeList(null, 1, 0, size.address()) &&476 ctypes.winLastError != win32.ERROR_INSUFFICIENT_BUFFER) {477 return null;478 }479 let attrList = win32.PROC_THREAD_ATTRIBUTE_LIST(size.value);480 if (!libc.InitializeProcThreadAttributeList(attrList, 1, 0, size.address())) {481 return null;482 }483 let ok = libc.UpdateProcThreadAttribute(484 attrList, 0, win32.PROC_THREAD_ATTRIBUTE_HANDLE_LIST,485 handles, handles.constructor.size, null, null);486 if (!ok) {487 libc.DeleteProcThreadAttributeList(attrList);488 return null;489 }490 return attrList;...

Full Screen

Full Screen

subprocess_shared_win.js

Source:subprocess_shared_win.js Github

copy

Full Screen

1/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */2/* vim: set sts=2 sw=2 et tw=80: */3/* This Source Code Form is subject to the terms of the Mozilla Public4 * License, v. 2.0. If a copy of the MPL was not distributed with this5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */6"use strict";7/* exported LIBC, Win, createPipe, libc */8// This file is loaded into the same scope as subprocess_win.jsm9/* import-globals-from subprocess_win.jsm */10const LIBC = OS.Constants.libc;11const Win = OS.Constants.Win;12const LIBC_CHOICES = ["kernel32.dll"];13var win32 = {14 // On Windows 64, winapi_abi is an alias for default_abi.15 WINAPI: ctypes.winapi_abi,16 VOID: ctypes.void_t,17 BYTE: ctypes.uint8_t,18 WORD: ctypes.uint16_t,19 DWORD: ctypes.uint32_t,20 LONG: ctypes.long,21 LARGE_INTEGER: ctypes.int64_t,22 ULONGLONG: ctypes.uint64_t,23 UINT: ctypes.unsigned_int,24 UCHAR: ctypes.unsigned_char,25 BOOL: ctypes.bool,26 HANDLE: ctypes.voidptr_t,27 PVOID: ctypes.voidptr_t,28 LPVOID: ctypes.voidptr_t,29 CHAR: ctypes.char,30 WCHAR: ctypes.jschar,31 ULONG_PTR: ctypes.uintptr_t,32 SIZE_T: ctypes.size_t,33 PSIZE_T: ctypes.size_t.ptr,34};35Object.assign(win32, {36 DWORD_PTR: win32.ULONG_PTR,37 LPSTR: win32.CHAR.ptr,38 LPWSTR: win32.WCHAR.ptr,39 LPBYTE: win32.BYTE.ptr,40 LPDWORD: win32.DWORD.ptr,41 LPHANDLE: win32.HANDLE.ptr,42 // This is an opaque type.43 PROC_THREAD_ATTRIBUTE_LIST: ctypes.char.array(),44 LPPROC_THREAD_ATTRIBUTE_LIST: ctypes.char.ptr,45});46Object.assign(win32, {47 LPCSTR: win32.LPSTR,48 LPCWSTR: win32.LPWSTR,49 LPCVOID: win32.LPVOID,50});51Object.assign(win32, {52 INVALID_HANDLE_VALUE: ctypes.cast(ctypes.int64_t(-1), win32.HANDLE),53 NULL_HANDLE_VALUE: ctypes.cast(ctypes.uintptr_t(0), win32.HANDLE),54 CREATE_SUSPENDED: 0x00000004,55 CREATE_NEW_CONSOLE: 0x00000010,56 CREATE_UNICODE_ENVIRONMENT: 0x00000400,57 CREATE_NO_WINDOW: 0x08000000,58 CREATE_BREAKAWAY_FROM_JOB: 0x01000000,59 EXTENDED_STARTUPINFO_PRESENT: 0x00080000,60 STARTF_USESTDHANDLES: 0x0100,61 DUPLICATE_CLOSE_SOURCE: 0x01,62 DUPLICATE_SAME_ACCESS: 0x02,63 ERROR_HANDLE_EOF: 38,64 ERROR_BROKEN_PIPE: 109,65 ERROR_INSUFFICIENT_BUFFER: 122,66 FILE_FLAG_OVERLAPPED: 0x40000000,67 PIPE_TYPE_BYTE: 0x00,68 PIPE_ACCESS_INBOUND: 0x01,69 PIPE_ACCESS_OUTBOUND: 0x02,70 PIPE_ACCESS_DUPLEX: 0x03,71 PIPE_WAIT: 0x00,72 PIPE_NOWAIT: 0x01,73 STILL_ACTIVE: 259,74 PROC_THREAD_ATTRIBUTE_HANDLE_LIST: 0x00020002,75 JobObjectBasicLimitInformation: 2,76 JobObjectExtendedLimitInformation: 9,77 JOB_OBJECT_LIMIT_BREAKAWAY_OK: 0x00000800,78 // These constants are 32-bit unsigned integers, but Windows defines79 // them as negative integers cast to an unsigned type.80 STD_INPUT_HANDLE: -10 + 0x100000000,81 STD_OUTPUT_HANDLE: -11 + 0x100000000,82 STD_ERROR_HANDLE: -12 + 0x100000000,83 WAIT_TIMEOUT: 0x00000102,84 WAIT_FAILED: 0xffffffff,85});86Object.assign(win32, {87 JOBOBJECT_BASIC_LIMIT_INFORMATION: new ctypes.StructType("JOBOBJECT_BASIC_LIMIT_INFORMATION", [88 {"PerProcessUserTimeLimit": win32.LARGE_INTEGER},89 {"PerJobUserTimeLimit": win32.LARGE_INTEGER},90 {"LimitFlags": win32.DWORD},91 {"MinimumWorkingSetSize": win32.SIZE_T},92 {"MaximumWorkingSetSize": win32.SIZE_T},93 {"ActiveProcessLimit": win32.DWORD},94 {"Affinity": win32.ULONG_PTR},95 {"PriorityClass": win32.DWORD},96 {"SchedulingClass": win32.DWORD},97 ]),98 IO_COUNTERS: new ctypes.StructType("IO_COUNTERS", [99 {"ReadOperationCount": win32.ULONGLONG},100 {"WriteOperationCount": win32.ULONGLONG},101 {"OtherOperationCount": win32.ULONGLONG},102 {"ReadTransferCount": win32.ULONGLONG},103 {"WriteTransferCount": win32.ULONGLONG},104 {"OtherTransferCount": win32.ULONGLONG},105 ]),106});107Object.assign(win32, {108 JOBOBJECT_EXTENDED_LIMIT_INFORMATION: new ctypes.StructType("JOBOBJECT_EXTENDED_LIMIT_INFORMATION", [109 {"BasicLimitInformation": win32.JOBOBJECT_BASIC_LIMIT_INFORMATION},110 {"IoInfo": win32.IO_COUNTERS},111 {"ProcessMemoryLimit": win32.SIZE_T},112 {"JobMemoryLimit": win32.SIZE_T},113 {"PeakProcessMemoryUsed": win32.SIZE_T},114 {"PeakJobMemoryUsed": win32.SIZE_T},115 ]),116 OVERLAPPED: new ctypes.StructType("OVERLAPPED", [117 {"Internal": win32.ULONG_PTR},118 {"InternalHigh": win32.ULONG_PTR},119 {"Offset": win32.DWORD},120 {"OffsetHigh": win32.DWORD},121 {"hEvent": win32.HANDLE},122 ]),123 PROCESS_INFORMATION: new ctypes.StructType("PROCESS_INFORMATION", [124 {"hProcess": win32.HANDLE},125 {"hThread": win32.HANDLE},126 {"dwProcessId": win32.DWORD},127 {"dwThreadId": win32.DWORD},128 ]),129 SECURITY_ATTRIBUTES: new ctypes.StructType("SECURITY_ATTRIBUTES", [130 {"nLength": win32.DWORD},131 {"lpSecurityDescriptor": win32.LPVOID},132 {"bInheritHandle": win32.BOOL},133 ]),134 STARTUPINFOW: new ctypes.StructType("STARTUPINFOW", [135 {"cb": win32.DWORD},136 {"lpReserved": win32.LPWSTR},137 {"lpDesktop": win32.LPWSTR},138 {"lpTitle": win32.LPWSTR},139 {"dwX": win32.DWORD},140 {"dwY": win32.DWORD},141 {"dwXSize": win32.DWORD},142 {"dwYSize": win32.DWORD},143 {"dwXCountChars": win32.DWORD},144 {"dwYCountChars": win32.DWORD},145 {"dwFillAttribute": win32.DWORD},146 {"dwFlags": win32.DWORD},147 {"wShowWindow": win32.WORD},148 {"cbReserved2": win32.WORD},149 {"lpReserved2": win32.LPBYTE},150 {"hStdInput": win32.HANDLE},151 {"hStdOutput": win32.HANDLE},152 {"hStdError": win32.HANDLE},153 ]),154});155Object.assign(win32, {156 STARTUPINFOEXW: new ctypes.StructType("STARTUPINFOEXW", [157 {"StartupInfo": win32.STARTUPINFOW},158 {"lpAttributeList": win32.LPPROC_THREAD_ATTRIBUTE_LIST},159 ]),160});161var libc = new Library("libc", LIBC_CHOICES, {162 AssignProcessToJobObject: [163 win32.WINAPI,164 win32.BOOL,165 win32.HANDLE, /* hJob */166 win32.HANDLE, /* hProcess */167 ],168 CloseHandle: [169 win32.WINAPI,170 win32.BOOL,171 win32.HANDLE, /* hObject */172 ],173 CreateEventW: [174 win32.WINAPI,175 win32.HANDLE,176 win32.SECURITY_ATTRIBUTES.ptr, /* opt lpEventAttributes */177 win32.BOOL, /* bManualReset */178 win32.BOOL, /* bInitialState */179 win32.LPWSTR, /* lpName */180 ],181 CreateFileW: [182 win32.WINAPI,183 win32.HANDLE,184 win32.LPWSTR, /* lpFileName */185 win32.DWORD, /* dwDesiredAccess */186 win32.DWORD, /* dwShareMode */187 win32.SECURITY_ATTRIBUTES.ptr, /* opt lpSecurityAttributes */188 win32.DWORD, /* dwCreationDisposition */189 win32.DWORD, /* dwFlagsAndAttributes */190 win32.HANDLE, /* opt hTemplateFile */191 ],192 CreateJobObjectW: [193 win32.WINAPI,194 win32.HANDLE,195 win32.SECURITY_ATTRIBUTES.ptr, /* opt lpJobAttributes */196 win32.LPWSTR, /* lpName */197 ],198 CreateNamedPipeW: [199 win32.WINAPI,200 win32.HANDLE,201 win32.LPWSTR, /* lpName */202 win32.DWORD, /* dwOpenMode */203 win32.DWORD, /* dwPipeMode */204 win32.DWORD, /* nMaxInstances */205 win32.DWORD, /* nOutBufferSize */206 win32.DWORD, /* nInBufferSize */207 win32.DWORD, /* nDefaultTimeOut */208 win32.SECURITY_ATTRIBUTES.ptr, /* opt lpSecurityAttributes */209 ],210 CreatePipe: [211 win32.WINAPI,212 win32.BOOL,213 win32.LPHANDLE, /* out hReadPipe */214 win32.LPHANDLE, /* out hWritePipe */215 win32.SECURITY_ATTRIBUTES.ptr, /* opt lpPipeAttributes */216 win32.DWORD, /* nSize */217 ],218 CreateProcessW: [219 win32.WINAPI,220 win32.BOOL,221 win32.LPCWSTR, /* lpApplicationName */222 win32.LPWSTR, /* lpCommandLine */223 win32.SECURITY_ATTRIBUTES.ptr, /* lpProcessAttributes */224 win32.SECURITY_ATTRIBUTES.ptr, /* lpThreadAttributes */225 win32.BOOL, /* bInheritHandle */226 win32.DWORD, /* dwCreationFlags */227 win32.LPVOID, /* opt lpEnvironment */228 win32.LPCWSTR, /* opt lpCurrentDirectory */229 win32.STARTUPINFOW.ptr, /* lpStartupInfo */230 win32.PROCESS_INFORMATION.ptr, /* out lpProcessInformation */231 ],232 CreateSemaphoreW: [233 win32.WINAPI,234 win32.HANDLE,235 win32.SECURITY_ATTRIBUTES.ptr, /* opt lpSemaphoreAttributes */236 win32.LONG, /* lInitialCount */237 win32.LONG, /* lMaximumCount */238 win32.LPCWSTR, /* opt lpName */239 ],240 DeleteProcThreadAttributeList: [241 win32.WINAPI,242 win32.VOID,243 win32.LPPROC_THREAD_ATTRIBUTE_LIST, /* in/out lpAttributeList */244 ],245 DuplicateHandle: [246 win32.WINAPI,247 win32.BOOL,248 win32.HANDLE, /* hSourceProcessHandle */249 win32.HANDLE, /* hSourceHandle */250 win32.HANDLE, /* hTargetProcessHandle */251 win32.LPHANDLE, /* out lpTargetHandle */252 win32.DWORD, /* dwDesiredAccess */253 win32.BOOL, /* bInheritHandle */254 win32.DWORD, /* dwOptions */255 ],256 FreeEnvironmentStringsW: [257 win32.WINAPI,258 win32.BOOL,259 win32.LPCWSTR, /* lpszEnvironmentBlock */260 ],261 GetCurrentProcess: [262 win32.WINAPI,263 win32.HANDLE,264 ],265 GetCurrentProcessId: [266 win32.WINAPI,267 win32.DWORD,268 ],269 GetEnvironmentStringsW: [270 win32.WINAPI,271 win32.LPCWSTR,272 ],273 GetExitCodeProcess: [274 win32.WINAPI,275 win32.BOOL,276 win32.HANDLE, /* hProcess */277 win32.LPDWORD, /* lpExitCode */278 ],279 GetOverlappedResult: [280 win32.WINAPI,281 win32.BOOL,282 win32.HANDLE, /* hFile */283 win32.OVERLAPPED.ptr, /* lpOverlapped */284 win32.LPDWORD, /* lpNumberOfBytesTransferred */285 win32.BOOL, /* bWait */286 ],287 GetStdHandle: [288 win32.WINAPI,289 win32.HANDLE,290 win32.DWORD, /* nStdHandle */291 ],292 InitializeProcThreadAttributeList: [293 win32.WINAPI,294 win32.BOOL,295 win32.LPPROC_THREAD_ATTRIBUTE_LIST, /* out opt lpAttributeList */296 win32.DWORD, /* dwAttributeCount */297 win32.DWORD, /* dwFlags */298 win32.PSIZE_T, /* in/out lpSize */299 ],300 ReadFile: [301 win32.WINAPI,302 win32.BOOL,303 win32.HANDLE, /* hFile */304 win32.LPVOID, /* out lpBuffer */305 win32.DWORD, /* nNumberOfBytesToRead */306 win32.LPDWORD, /* opt out lpNumberOfBytesRead */307 win32.OVERLAPPED.ptr, /* opt in/out lpOverlapped */308 ],309 ReleaseSemaphore: [310 win32.WINAPI,311 win32.BOOL,312 win32.HANDLE, /* hSemaphore */313 win32.LONG, /* lReleaseCount */314 win32.LONG.ptr, /* opt out lpPreviousCount */315 ],316 ResumeThread: [317 win32.WINAPI,318 win32.DWORD,319 win32.HANDLE, /* hThread */320 ],321 SetInformationJobObject: [322 win32.WINAPI,323 win32.BOOL,324 win32.HANDLE, /* hJob */325 ctypes.int, /* JobObjectInfoClass */326 win32.LPVOID, /* lpJobObjectInfo */327 win32.DWORD, /* cbJobObjectInfoLengt */328 ],329 TerminateJobObject: [330 win32.WINAPI,331 win32.BOOL,332 win32.HANDLE, /* hJob */333 win32.UINT, /* uExitCode */334 ],335 TerminateProcess: [336 win32.WINAPI,337 win32.BOOL,338 win32.HANDLE, /* hProcess */339 win32.UINT, /* uExitCode */340 ],341 UpdateProcThreadAttribute: [342 win32.WINAPI,343 win32.BOOL,344 win32.LPPROC_THREAD_ATTRIBUTE_LIST, /* in/out lpAttributeList */345 win32.DWORD, /* dwFlags */346 win32.DWORD_PTR, /* Attribute */347 win32.PVOID, /* lpValue */348 win32.SIZE_T, /* cbSize */349 win32.PVOID, /* out opt lpPreviousValue */350 win32.PSIZE_T, /* opt lpReturnSize */351 ],352 WaitForMultipleObjects: [353 win32.WINAPI,354 win32.DWORD,355 win32.DWORD, /* nCount */356 win32.HANDLE.ptr, /* hHandles */357 win32.BOOL, /* bWaitAll */358 win32.DWORD, /* dwMilliseconds */359 ],360 WaitForSingleObject: [361 win32.WINAPI,362 win32.DWORD,363 win32.HANDLE, /* hHandle */364 win32.BOOL, /* bWaitAll */365 win32.DWORD, /* dwMilliseconds */366 ],367 WriteFile: [368 win32.WINAPI,369 win32.BOOL,370 win32.HANDLE, /* hFile */371 win32.LPCVOID, /* lpBuffer */372 win32.DWORD, /* nNumberOfBytesToRead */373 win32.LPDWORD, /* opt out lpNumberOfBytesWritten */374 win32.OVERLAPPED.ptr, /* opt in/out lpOverlapped */375 ],376});377let nextNamedPipeId = 0;378win32.Handle = function(handle) {379 return ctypes.CDataFinalizer(win32.HANDLE(handle), libc.CloseHandle);380};381win32.createPipe = function(secAttr, readFlags = 0, writeFlags = 0, size = 0) {382 readFlags |= win32.PIPE_ACCESS_INBOUND;383 writeFlags |= Win.FILE_ATTRIBUTE_NORMAL;384 if (size == 0) {385 size = 4096;386 }387 let pid = libc.GetCurrentProcessId();388 let pipeName = String.raw`\\.\Pipe\SubProcessPipe.${pid}.${nextNamedPipeId++}`;389 let readHandle = libc.CreateNamedPipeW(390 pipeName, readFlags,391 win32.PIPE_TYPE_BYTE | win32.PIPE_WAIT,392 1, /* number of connections */393 size, /* output buffer size */394 size, /* input buffer size */395 0, /* timeout */396 secAttr.address());397 let isInvalid = handle => String(handle) == String(win32.HANDLE(Win.INVALID_HANDLE_VALUE));398 if (isInvalid(readHandle)) {399 return [];400 }401 let writeHandle = libc.CreateFileW(402 pipeName, Win.GENERIC_WRITE, 0, secAttr.address(),403 Win.OPEN_EXISTING, writeFlags, null);404 if (isInvalid(writeHandle)) {405 libc.CloseHandle(readHandle);406 return [];407 }408 return [win32.Handle(readHandle),409 win32.Handle(writeHandle)];410};411win32.createThreadAttributeList = function(handles) {412 try {413 void libc.InitializeProcThreadAttributeList;414 void libc.DeleteProcThreadAttributeList;415 void libc.UpdateProcThreadAttribute;416 } catch (e) {417 // This is only supported in Windows Vista and later.418 return null;419 }420 let size = win32.SIZE_T();421 if (!libc.InitializeProcThreadAttributeList(null, 1, 0, size.address()) &&422 ctypes.winLastError != win32.ERROR_INSUFFICIENT_BUFFER) {423 return null;424 }425 let attrList = win32.PROC_THREAD_ATTRIBUTE_LIST(size.value);426 if (!libc.InitializeProcThreadAttributeList(attrList, 1, 0, size.address())) {427 return null;428 }429 let ok = libc.UpdateProcThreadAttribute(430 attrList, 0, win32.PROC_THREAD_ATTRIBUTE_HANDLE_LIST,431 handles, handles.constructor.size, null, null);432 if (!ok) {433 libc.DeleteProcThreadAttributeList(attrList);434 return null;435 }436 return attrList;...

Full Screen

Full Screen

navtreeindex66.js

Source:navtreeindex66.js Github

copy

Full Screen

1var NAVTREEINDEX66 =2{3"util-vector_8h_source.html":[5,0,1,811],4"win32-misc_8c.html":[5,0,1,812],5"win32-misc_8c_source.html":[5,0,1,812],6"win32-misc_8h.html":[5,0,1,813],7"win32-misc_8h.html#a33c6dca97bbc9e329d37013ac3088f66":[5,0,1,813,1],8"win32-misc_8h.html#a57fb500ec9c9c6625bfa5031b419cfd6":[5,0,1,813,7],9"win32-misc_8h.html#a8227c495a4fdf3385a170810f90c2b78":[5,0,1,813,2],10"win32-misc_8h.html#a82d4d551b214905742c9e045185d352a":[5,0,1,813,3],11"win32-misc_8h.html#a8b4e65d5530474709182ee0d9faa6dda":[5,0,1,813,5],12"win32-misc_8h.html#a8c35ae4e83034731f6aecfb34c883ecf":[5,0,1,813,4],13"win32-misc_8h.html#a8c996258959222a38a0d4c35d8e22105":[5,0,1,813,8],14"win32-misc_8h.html#acdce1d46efd09e8485a2f682b388ebc0":[5,0,1,813,6],15"win32-misc_8h.html#adaaf2b22de5705e2e8190e0b0214268c":[5,0,1,813,0],16"win32-misc_8h_source.html":[5,0,1,813],17"win32-service_8c.html":[5,0,1,814],18"win32-service_8c_source.html":[5,0,1,814],19"win32-service_8h.html":[5,0,1,815],20"win32-service_8h_source.html":[5,0,1,815],21"win32-syslog_8h.html":[5,0,1,816],22"win32-syslog_8h.html#a12b2a3bb9e3adfeb35b4e5514e7d9043":[5,0,1,816,1],23"win32-syslog_8h.html#a135a6127cf9b508b4361594e842eefc0":[5,0,1,816,22],24"win32-syslog_8h.html#a22b8a93c6a27426f9a8ad4ce9407e86d":[5,0,1,816,2],25"win32-syslog_8h.html#a25eab08bcadd790ad09db8ab1391d7b4":[5,0,1,816,13],26"win32-syslog_8h.html#a285963d2ea1986d2f31ae7c6c0b5dc4e":[5,0,1,816,5],27"win32-syslog_8h.html#a3782c789d7d0eeab593758f80e436da4":[5,0,1,816,12],28"win32-syslog_8h.html#a3bba702c131c9a343f43cefe9dc54806":[5,0,1,816,15],29"win32-syslog_8h.html#a3c6927ac15f5eaa92ee6d79b2837b68e":[5,0,1,816,21],30"win32-syslog_8h.html#a5c6e8b60c2512dfc0e0224d25a61cb2c":[5,0,1,816,8],31"win32-syslog_8h.html#a692679f0c66ec0af21cf1232c90dd843":[5,0,1,816,3],32"win32-syslog_8h.html#a6ff63e8955665c4a58b1598f2b07c51a":[5,0,1,816,7],33"win32-syslog_8h.html#a71d48fd009db4d4e57019903d372347a":[5,0,1,816,19],34"win32-syslog_8h.html#a7c96c20eb0501c681dea19b78c36e475":[5,0,1,816,17],35"win32-syslog_8h.html#a7f58aba233777e6fff2fbf143771a3ff":[5,0,1,816,0],36"win32-syslog_8h.html#a92fab4ab2e651417f9b775c25c2c27b7":[5,0,1,816,30],37"win32-syslog_8h.html#a96fad55b3f5adf08c39e4c877cf185e3":[5,0,1,816,9],38"win32-syslog_8h.html#a9961fc94ec213d970dc7c8d9608e1d42":[5,0,1,816,6],39"win32-syslog_8h.html#aa18025777cde11407777e8153745a9ee":[5,0,1,816,31],40"win32-syslog_8h.html#aaa731313f5c63e855fefb5f6519c3283":[5,0,1,816,4],41"win32-syslog_8h.html#aac5b42b45757c49927892523f0367356":[5,0,1,816,25],42"win32-syslog_8h.html#aadb5d42621c4abbde2c82b5412d8df8a":[5,0,1,816,29],43"win32-syslog_8h.html#ab0db5f3df16ec19a5897b852930bca54":[5,0,1,816,27],44"win32-syslog_8h.html#ac19bfe79880b74eb63d406c218c89350":[5,0,1,816,18],45"win32-syslog_8h.html#ac8b1ae5666bff93a5db0bb45f99f5832":[5,0,1,816,26],46"win32-syslog_8h.html#acf5d4c2811adb735aaf5b32f62cc3cea":[5,0,1,816,10],47"win32-syslog_8h.html#ad89ee324d180cdcd7defcc709ff9ca42":[5,0,1,816,24],48"win32-syslog_8h.html#adc43741bf59af027c44c46f6c4692592":[5,0,1,816,16],49"win32-syslog_8h.html#adf4476a6a4ea6c74231c826e899d7189":[5,0,1,816,28],50"win32-syslog_8h.html#ae2702880c720b92d9b133a394536fc55":[5,0,1,816,14],51"win32-syslog_8h.html#aea1efd5b3880503ca94c623d0517e497":[5,0,1,816,20],52"win32-syslog_8h.html#aeae7c4754f60a7931ce0141bac37e798":[5,0,1,816,23],53"win32-syslog_8h.html#aeb4f36db01bd128c7afeac5889dac311":[5,0,1,816,11],54"win32-syslog_8h_source.html":[5,0,1,816]...

Full Screen

Full Screen

win32_8h.js

Source:win32_8h.js Github

copy

Full Screen

1var win32_8h =2[3 [ "msghdr", "structmsghdr.html", "structmsghdr" ],4 [ "rusage", "structrusage.html", "structrusage" ],5 [ "sigaction", "structsigaction.html", "structsigaction" ],6 [ "_WIN32_WINNT", "win32_8h.html#ac50762666aa00bd3a4308158510f1748", null ],7 [ "close", "win32_8h.html#a4ef17e85ec4d3acdcee5ce23f8ed93c4", null ],8 [ "daemonize", "win32_8h.html#a862090b2d7e8cf79ac3014219ac1eb24", null ],9 [ "DELTA_EPOCH_IN_MICROSECS", "win32_8h.html#ae1da7f152502f82284c9d06e5695fd25", null ],10 [ "EADDRINUSE", "win32_8h.html#a61676e39b42371c65c3b960a91887b03", null ],11 [ "EAFNOSUPPORT", "win32_8h.html#a4c3a793b4d51cb7dd020af92e536fe21", null ],12 [ "EAI_SYSTEM", "win32_8h.html#a8e864fa95f26341c27127deb6237c88c", null ],13 [ "ECONNRESET", "win32_8h.html#add4258b08af02fbe4590fbaae7260037", null ],14 [ "ENOTCONN", "win32_8h.html#af23e48762a0676f49d480db91cfd5e4b", null ],15 [ "EWOULDBLOCK", "win32_8h.html#a4a3a0b3605fd3b2336455062ee8e25f0", null ],16 [ "F_GETFL", "win32_8h.html#a025fad21a889c79f02ec53abe3526c32", null ],17 [ "F_SETFL", "win32_8h.html#af2939853c650561d3495ed40f68f6249", null ],18 [ "IOV_MAX", "win32_8h.html#a25080e819a36fcf9aede01a6e7298ea4", null ],19 [ "O_BLOCK", "win32_8h.html#a02040167605ed3f6c09139e613ae8c0f", null ],20 [ "O_NONBLOCK", "win32_8h.html#a39d33ce33804efd4d52606d59071c6d8", null ],21 [ "read", "win32_8h.html#ac964c1144d52dfefcb8d4dcd1ce9121b", null ],22 [ "recv", "win32_8h.html#ade6caa1382b65c7ee38bd0b686e4902f", null ],23 [ "RUSAGE_SELF", "win32_8h.html#af96c310e02eee3878d8fb3af154c2ba0", null ],24 [ "sigemptyset", "win32_8h.html#a3690d34646b4deaf2b61ac0cb32a9d93", null ],25 [ "SIGHUP", "win32_8h.html#a136c64ec2d1306de745e39d6aee362ca", null ],26 [ "strtok_r", "win32_8h.html#a393ce1fcf024a89038fa6d5e50561b4b", null ],27 [ "write", "win32_8h.html#ac40a1eaac5f8dbc1eef9b944d494770c", null ],28 [ "caddr_t", "win32_8h.html#a947150611d74d1400ef3f0af0776aadd", null ],29 [ "getrusage", "win32_8h.html#ad6bbdf27bfe56f9ba1653a187be4c518", null ],30 [ "inet_aton", "win32_8h.html#a3d784f44d05c742102f2dc36425dbbdd", null ],31 [ "kill", "win32_8h.html#a17629c5f27ae250d924b74b1789e3b27", null ],32 [ "mapErr", "win32_8h.html#ac80c50c225f35507108ba76a0522b2cd", null ],33 [ "mem_recv", "win32_8h.html#aeafb72e11571f44739c6597a3dbd8e0e", null ],34 [ "mem_write", "win32_8h.html#a16036884ffc296512bb359a1611ad294", null ],35 [ "sendmsg", "win32_8h.html#af5f6c37a113d6fb2852c3ab158634c4b", null ],36 [ "sigaction", "win32_8h.html#a116c425ee3f26d46d26db15c1fa4c84d", null ],37 [ "sleep", "win32_8h.html#ae218bf2bcd5435df2bffc0493b0a7a9f", null ],38 [ "spawn_memcached", "win32_8h.html#a501f11def6f7dc34956d0e6e4f725160", null ]...

Full Screen

Full Screen

test-path-dirname.js

Source:test-path-dirname.js Github

copy

Full Screen

1'use strict';2var tape = require('tape');3var path = require('../');4tape('path.posix.dirname', function (t) {5 t.strictEqual(path.posix.dirname('/a/b/'), '/a');6 t.strictEqual(path.posix.dirname('/a/b'), '/a');7 t.strictEqual(path.posix.dirname('/a'), '/');8 t.strictEqual(path.posix.dirname(''), '.');9 t.strictEqual(path.posix.dirname('/'), '/');10 t.strictEqual(path.posix.dirname('////'), '/');11 t.strictEqual(path.posix.dirname('//a'), '//');12 t.strictEqual(path.posix.dirname('foo'), '.');13 t.end();14});15tape('path.win32.dirname', { skip: true }, function (t) {16 t.strictEqual(path.win32.dirname('c:\\'), 'c:\\');17 t.strictEqual(path.win32.dirname('c:\\foo'), 'c:\\');18 t.strictEqual(path.win32.dirname('c:\\foo\\'), 'c:\\');19 t.strictEqual(path.win32.dirname('c:\\foo\\bar'), 'c:\\foo');20 t.strictEqual(path.win32.dirname('c:\\foo\\bar\\'), 'c:\\foo');21 t.strictEqual(path.win32.dirname('c:\\foo\\bar\\baz'), 'c:\\foo\\bar');22 t.strictEqual(path.win32.dirname('\\'), '\\');23 t.strictEqual(path.win32.dirname('\\foo'), '\\');24 t.strictEqual(path.win32.dirname('\\foo\\'), '\\');25 t.strictEqual(path.win32.dirname('\\foo\\bar'), '\\foo');26 t.strictEqual(path.win32.dirname('\\foo\\bar\\'), '\\foo');27 t.strictEqual(path.win32.dirname('\\foo\\bar\\baz'), '\\foo\\bar');28 t.strictEqual(path.win32.dirname('c:'), 'c:');29 t.strictEqual(path.win32.dirname('c:foo'), 'c:');30 t.strictEqual(path.win32.dirname('c:foo\\'), 'c:');31 t.strictEqual(path.win32.dirname('c:foo\\bar'), 'c:foo');32 t.strictEqual(path.win32.dirname('c:foo\\bar\\'), 'c:foo');33 t.strictEqual(path.win32.dirname('c:foo\\bar\\baz'), 'c:foo\\bar');34 t.strictEqual(path.win32.dirname('file:stream'), '.');35 t.strictEqual(path.win32.dirname('dir\\file:stream'), 'dir');36 t.strictEqual(path.win32.dirname('\\\\unc\\share'),37 '\\\\unc\\share');38 t.strictEqual(path.win32.dirname('\\\\unc\\share\\foo'),39 '\\\\unc\\share\\');40 t.strictEqual(path.win32.dirname('\\\\unc\\share\\foo\\'),41 '\\\\unc\\share\\');42 t.strictEqual(path.win32.dirname('\\\\unc\\share\\foo\\bar'),43 '\\\\unc\\share\\foo');44 t.strictEqual(path.win32.dirname('\\\\unc\\share\\foo\\bar\\'),45 '\\\\unc\\share\\foo');46 t.strictEqual(path.win32.dirname('\\\\unc\\share\\foo\\bar\\baz'),47 '\\\\unc\\share\\foo\\bar');48 t.strictEqual(path.win32.dirname('/a/b/'), '/a');49 t.strictEqual(path.win32.dirname('/a/b'), '/a');50 t.strictEqual(path.win32.dirname('/a'), '/');51 t.strictEqual(path.win32.dirname(''), '.');52 t.strictEqual(path.win32.dirname('/'), '/');53 t.strictEqual(path.win32.dirname('////'), '/');54 t.strictEqual(path.win32.dirname('foo'), '.');55 t.end();...

Full Screen

Full Screen

aflprep_test-path-dirname.js

Source:aflprep_test-path-dirname.js Github

copy

Full Screen

1'use strict';2const assert = require('assert');3const path = require('path');4assert.strictEqual(path.dirname(__filename).substr(-13),5assert.strictEqual(path.posix.dirname(''), '.');6assert.strictEqual(path.posix.dirname('foo'), '.');7assert.strictEqual(path.win32.dirname('c:\\'), 'c:\\');8assert.strictEqual(path.win32.dirname('c:\\foo'), 'c:\\');9assert.strictEqual(path.win32.dirname('c:\\foo\\'), 'c:\\');10assert.strictEqual(path.win32.dirname('c:\\foo\\bar'), 'c:\\foo');11assert.strictEqual(path.win32.dirname('c:\\foo\\bar\\'), 'c:\\foo');12assert.strictEqual(path.win32.dirname('c:\\foo\\bar\\baz'), 'c:\\foo\\bar');13assert.strictEqual(path.win32.dirname('c:\\foo bar\\baz'), 'c:\\foo bar');14assert.strictEqual(path.win32.dirname('\\'), '\\');15assert.strictEqual(path.win32.dirname('\\foo'), '\\');16assert.strictEqual(path.win32.dirname('\\foo\\'), '\\');17assert.strictEqual(path.win32.dirname('\\foo\\bar'), '\\foo');18assert.strictEqual(path.win32.dirname('\\foo\\bar\\'), '\\foo');19assert.strictEqual(path.win32.dirname('\\foo\\bar\\baz'), '\\foo\\bar');20assert.strictEqual(path.win32.dirname('\\foo bar\\baz'), '\\foo bar');21assert.strictEqual(path.win32.dirname('c:'), 'c:');22assert.strictEqual(path.win32.dirname('c:foo'), 'c:');23assert.strictEqual(path.win32.dirname('c:foo\\'), 'c:');24assert.strictEqual(path.win32.dirname('c:foo\\bar'), 'c:foo');25assert.strictEqual(path.win32.dirname('c:foo\\bar\\'), 'c:foo');26assert.strictEqual(path.win32.dirname('c:foo\\bar\\baz'), 'c:foo\\bar');27assert.strictEqual(path.win32.dirname('c:foo bar\\baz'), 'c:foo bar');28assert.strictEqual(path.win32.dirname('file:stream'), '.');29assert.strictEqual(path.win32.dirname('dir\\file:stream'), 'dir');30assert.strictEqual(path.win32.dirname('\\\\unc\\share'),31 '\\\\unc\\share');32assert.strictEqual(path.win32.dirname('\\\\unc\\share\\foo'),33 '\\\\unc\\share\\');34assert.strictEqual(path.win32.dirname('\\\\unc\\share\\foo\\'),35 '\\\\unc\\share\\');36assert.strictEqual(path.win32.dirname('\\\\unc\\share\\foo\\bar'),37 '\\\\unc\\share\\foo');38assert.strictEqual(path.win32.dirname('\\\\unc\\share\\foo\\bar\\'),39 '\\\\unc\\share\\foo');40assert.strictEqual(path.win32.dirname('\\\\unc\\share\\foo\\bar\\baz'),41 '\\\\unc\\share\\foo\\bar');42assert.strictEqual(path.win32.dirname(''), '.');...

Full Screen

Full Screen

dl_core.js

Source:dl_core.js Github

copy

Full Screen

1const axios = require('axios').default2const fs = require('fs')3const util = require('util')4const path = require('path')5const version = 'v1.0.10'6const linkPrefix = 'https://github.com/mellow-io/go-tun2socks/releases/download'7const links = {8 darwin: util.format('%s/%s/core-darwin-10.6-amd64', linkPrefix, version),9 linux: util.format('%s/%s/core-linux-amd64', linkPrefix, version),10 win32: util.format('%s/%s/core-windows-4.0-amd64.exe', linkPrefix, version)11}12const dsts = {13 darwin: path.join(__dirname, '../src/helper/darwin/core'),14 linux: path.join(__dirname, '../src/helper/linux/core'),15 win32: path.join(__dirname, '../src/helper/win32/core.exe')16}17async function download(url, filePath) {18 const writer = fs.createWriteStream(filePath)19 console.log('Downloading', url)20 const resp = await axios({21 url,22 method: 'GET',23 responseType: 'stream',24 onDownloadProgress: (e) => {25 console.log(e)26 }27 })28 resp.data.pipe(writer)29 writer.on('finish', () => {30 console.log('Saved file', filePath)31 })32 writer.on('error', (err) => {33 console.log('Download failed.', err)34 })35}36if (process.argv.length > 2) {37 if (process.argv[2] == '--all') {38 download(links.darwin, dsts.darwin)39 download(links.linux, dsts.linux)40 download(links.win32, dsts.win32)41 }42 if (process.argv[2] == '--darwin') {43 download(links.darwin, dsts.darwin)44 }45 if (process.argv[2] == '--linux') {46 download(links.linux, dsts.linux)47 }48 if (process.argv[2] == '--win' || process.argv[2] == '--win32') {49 download(links.win32, dsts.win32)50 }51} else {52 switch (process.platform) {53 case 'darwin':54 download(links.darwin, dsts.darwin)55 break56 case 'linux':57 download(links.linux, dsts.linux)58 break59 case 'win32':60 download(links.win32, dsts.win32)61 break62 }...

Full Screen

Full Screen

test-path-isabsolute.js

Source:test-path-isabsolute.js Github

copy

Full Screen

1'use strict';2var tape = require('tape');3var path = require('../');4tape('path.win32.isAbsolute', { skip: true }, function (t) {5 t.strictEqual(path.win32.isAbsolute('/'), true);6 t.strictEqual(path.win32.isAbsolute('//'), true);7 t.strictEqual(path.win32.isAbsolute('//server'), true);8 t.strictEqual(path.win32.isAbsolute('//server/file'), true);9 t.strictEqual(path.win32.isAbsolute('\\\\server\\file'), true);10 t.strictEqual(path.win32.isAbsolute('\\\\server'), true);11 t.strictEqual(path.win32.isAbsolute('\\\\'), true);12 t.strictEqual(path.win32.isAbsolute('c'), false);13 t.strictEqual(path.win32.isAbsolute('c:'), false);14 t.strictEqual(path.win32.isAbsolute('c:\\'), true);15 t.strictEqual(path.win32.isAbsolute('c:/'), true);16 t.strictEqual(path.win32.isAbsolute('c://'), true);17 t.strictEqual(path.win32.isAbsolute('C:/Users/'), true);18 t.strictEqual(path.win32.isAbsolute('C:\\Users\\'), true);19 t.strictEqual(path.win32.isAbsolute('C:cwd/another'), false);20 t.strictEqual(path.win32.isAbsolute('C:cwd\\another'), false);21 t.strictEqual(path.win32.isAbsolute('directory/directory'), false);22 t.strictEqual(path.win32.isAbsolute('directory\\directory'), false);23 t.end();24});25tape('path.posix.isAbsolute', function (t) {26 t.strictEqual(path.posix.isAbsolute('/home/foo'), true);27 t.strictEqual(path.posix.isAbsolute('/home/foo/..'), true);28 t.strictEqual(path.posix.isAbsolute('bar/'), false);29 t.strictEqual(path.posix.isAbsolute('./baz'), false);30 t.end();...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { remote } = require('webdriverio');2(async () => {3 const browser = await remote({4 capabilities: {5 'ms:edgeOptions': {6 }7 }8 })9 console.log(await browser.getTitle())10 await browser.deleteSession()11})().catch((e) => console.error(e))12const { Builder, By, Key, until } = require('selenium-webdriver');13const { Options } = require('selenium-webdriver/chrome');14const { Capabilities } = require('selenium-webdriver/lib/capabilities');15const capabilities = Capabilities.chrome();16capabilities.set('ms:edgeOptions', { args: ['--headless', '--disable-gpu', '--no-sandbox'] });17const options = new Options().setChromeBinaryPath("C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe");18const driver = new Builder()19 .forBrowser('chrome')20 .withCapabilities(capabilities)21 .setChromeOptions(options)22 .build();23driver.quit();24const { Builder, By, Key, until } = require('selenium-webdriver');25const { Options } = require('selenium-webdriver/chrome');26const { Capabilities } = require('selenium-webdriver/lib/capabilities');27const capabilities = Capabilities.chrome();28capabilities.set('ms:edgeOptions', { args: ['--headless', '--disable-gpu', '--no-sandbox'] });29const options = new Options().setChromeBinaryPath("C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe");30const driver = new Builder()31 .forBrowser('chrome')32 .withCapabilities(capabilities)33 .setChromeOptions(options)34 .build();35driver.quit();36const { Builder, By, Key, until

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriverio = require('webdriverio');2var options = { desiredCapabilities: { browserName: 'chrome' } };3var client = webdriverio.remote(options);4 .init()5 .setValue('#lst-ib', 'webdriverio')6 .click('#tsbb')7 .pause(1000)8 .getTitle().then(function(title) {9 console.log('Title was: ' + title);10 })11 .end();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { remote } = require('webdriverio')2async function main () {3 const browser = await remote({4 capabilities: {5 }6 })7 console.log(await browser.getTitle())8 await browser.deleteSession()9}10main()

Full Screen

Using AI Code Generation

copy

Full Screen

1const { remote } = require('webdriverio');2const path = require('path');3(async () => {4 const browser = await remote({5 capabilities: {6 'ms:edgeOptions': {7 extensions: [path.resolve(__dirname, 'extension_1_0_0_0.crx')]8 }9 }10 })11 console.log(await browser.getTitle())12 await browser.deleteSession()13})().catch((e) => console.error(e))

Full Screen

Using AI Code Generation

copy

Full Screen

1const { remote } = require('webdriverio');2const { exec } = require('child_process');3(async () => {4 const browser = await remote({5 capabilities: {6 }7 });8 await browser.pause(3000);9 await browser.deleteSession();10})().catch((e) => console.error(e));11let cmd = 'node test.js';12exec(cmd, (err, stdout, stderr) => {13 if (err) {14 console.error(err);15 return;16 }17 console.log(stdout);18});

Full Screen

Using AI Code Generation

copy

Full Screen

1const { remote } = require('webdriverio');2const { join } = require('path');3const opts = {4 path: join(__dirname, '..', 'node_modules', '.bin'),5 capabilities: {6 }7}8async function main() {9 const browser = await remote(opts);10 console.log(await browser.getTitle());11 await browser.deleteSession();12}13main();

Full Screen

Using AI Code Generation

copy

Full Screen

1const wdio = require('webdriverio');2const path = require('path');3const fs = require('fs');4const assert = require('assert');5const opts = {6 desiredCapabilities: {7 }8};9const wdio = require('webdriverio');10const path = require('path');11const fs = require('fs');12const assert = require('assert');13const opts = {14 desiredCapabilities: {15 }16};17const wdio = require('webdriverio');18const path = require('path');19const fs = require('fs');20const assert = require('assert');21const opts = {22 desiredCapabilities: {23 }24};25const wdio = require('webdriverio');26const path = require('path');27const fs = require('fs');28const assert = require('assert');29const opts = {30 desiredCapabilities: {31 }32};33const wdio = require('webdriverio');34const path = require('path');35const fs = require('fs');36const assert = require('assert');37const opts = {38 desiredCapabilities: {39 }40};41const wdio = require('webdriverio');42const path = require('path');43const fs = require('fs');44const assert = require('assert');45const opts = {46 desiredCapabilities: {47 }48};49const wdio = require('webdriverio');50const path = require('path');51const fs = require('fs');52const assert = require('assert');53const opts = {54 desiredCapabilities: {55 }56};57const wdio = require('webdriverio');58const path = require('path');59const fs = require('fs');60const assert = require('assert');61const opts = {62 desiredCapabilities: {63 }64};

Full Screen

Using AI Code Generation

copy

Full Screen

1const { remote } = require('webdriverio')2const opts = {3 capabilities: {4 'goog:chromeOptions': {5 }6 }7}8const { remote } = require('webdriverio')9const opts = {10 capabilities: {11 'goog:chromeOptions': {12 }13 }14}15const { remote } = require('webdriverio')16const opts = {17 capabilities: {18 'goog:chromeOptions': {19 }20 }21}22const { remote } = require('webdriverio')23const opts = {24 capabilities: {25 'goog:chromeOptions': {26 }27 }28}29const { remote } = require('webdriverio')30const opts = {31 capabilities: {32 'goog:chromeOptions': {33 }34 }35}

Full Screen

Using AI Code Generation

copy

Full Screen

1browser.maximizeWindow();2browser.pause(3000);3browser.saveScreenshot("C:/Users/SAI/Desktop/Project/Google.png");4browser.pause(3000);5browser.saveScreenshot("C:/Users/SAI/Desktop/Project/Google1.png");6browser.pause(3000);7browser.saveScreenshot("C:/Users/SAI/Desktop/Project/Google2.png");8browser.pause(3000);9browser.saveScreenshot("C:/Users/SAI/Desktop/Project/Google3.png");10browser.pause(3000);11browser.saveScreenshot("C:/Users/SAI/Desktop/Project/Google4.png");12browser.pause(3000);13browser.saveScreenshot("C:/Users/SAI/Desktop/Project/Google5.png");14browser.pause(3000);15browser.saveScreenshot("C:/Users/SAI/Desktop/Project/Google6.png");16browser.pause(3000);17browser.saveScreenshot("C:/Users/SAI/Desktop/Project/Google7.png");18browser.pause(3000);19browser.saveScreenshot("C:/Users/SAI/Desktop/Project/Google8.png");20browser.pause(3000);21browser.saveScreenshot("C:/Users/SAI/Desktop/Project/Google9.png");22browser.pause(3000);23browser.saveScreenshot("C:/Users/SAI/Desktop/Project/Google10.png");24browser.pause(3000);25browser.saveScreenshot("C:/Users/SAI/Desktop/Project/Google11.png");26browser.pause(3000);27browser.saveScreenshot("C:/Users/SAI/Desktop/Project/Google12.png");28browser.pause(3000);29browser.saveScreenshot("C:/Users/SAI/Desktop/Project/Google13.png");30browser.pause(3000);31browser.saveScreenshot("C:/Users/SAI/Desktop/Project/Google14.png");32browser.pause(3000);33browser.saveScreenshot("C:/Users/SAI/Desktop/Project/Google15.png");34browser.pause(3000);35browser.saveScreenshot("C:/Users/SAI/Desktop/Project/Google16.png");36browser.pause(3000);37browser.saveScreenshot("C:/Users/SAI/Desktop/Project/Google17.png");38browser.pause(3000);39browser.saveScreenshot("C:/Users/SAI/Desktop/Project/Google18.png");40browser.pause(3000);41browser.saveScreenshot("C:/Users/SAI/Desktop/Project/Google19.png");42browser.pause(3000

Full Screen

WebdriverIO Tutorial

Wondering what could be a next-gen browser and mobile test automation framework that is also simple and concise? Yes, that’s right, it's WebdriverIO. Since the setup is very easy to follow compared to Selenium testing configuration, you can configure the features manually thereby being the center of attraction for automation testing. Therefore the testers adopt WedriverIO to fulfill their needs of browser testing.

Learn to run automation testing with WebdriverIO tutorial. Go from a beginner to a professional automation test expert with LambdaTest WebdriverIO tutorial.

Chapters

  1. Running Your First Automation Script - Learn the steps involved to execute your first Test Automation Script using WebdriverIO since the setup is very easy to follow and the features can be configured manually.

  2. Selenium Automation With WebdriverIO - Read more about automation testing with WebdriverIO and how it supports both browsers and mobile devices.

  3. Browser Commands For Selenium Testing - Understand more about the barriers faced while working on your Selenium Automation Scripts in WebdriverIO, the ‘browser’ object and how to use them?

  4. Handling Alerts & Overlay In Selenium - Learn different types of alerts faced during automation, how to handle these alerts and pops and also overlay modal in WebdriverIO.

  5. How To Use Selenium Locators? - Understand how Webdriver uses selenium locators in a most unique way since having to choose web elements very carefully for script execution is very important to get stable test results.

  6. Deep Selectors In Selenium WebdriverIO - The most popular automation testing framework that is extensively adopted by all the testers at a global level is WebdriverIO. Learn how you can use Deep Selectors in Selenium WebdriverIO.

  7. Handling Dropdown In Selenium - Learn more about handling dropdowns and how it's important while performing automated browser testing.

  8. Automated Monkey Testing with Selenium & WebdriverIO - Understand how you can leverage the amazing quality of WebdriverIO along with selenium framework to automate monkey testing of your website or web applications.

  9. JavaScript Testing with Selenium and WebdriverIO - Speed up your Javascript testing with Selenium and WebdriverIO.

  10. Cross Browser Testing With WebdriverIO - Learn more with this step-by-step tutorial about WebdriverIO framework and how cross-browser testing is done with WebdriverIO.

Run Webdriverio automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful