How to use win32 method in root

Best JavaScript code snippet using root

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 path = require('path');2console.log(path.win32.parse('C:\\path\\dir\\file.txt'));3const path = require('path');4console.log(path.posix.parse('/home/user/dir/file.txt'));5### path.relative(from, to)6- if from and to each resolve to the same path (after calling path.resolve() on each), a zero-length string is returned7const path = require('path');8console.log(path.relative('/data/orandea/test/aaa', '/data/orandea/impl/bbb'));9### path.resolve([from ...], to)10- if no arguments are passed in, path.resolve() will return the absolute path of the current working directory11- if a single path or an array of path segments are passed in, path.resolve() will return an absolute path12- if multiple path segments are passed in, path.resolve() will be called on each segment in order, with the result of each being used as the starting point for the next13const path = require('path');14console.log(path.resolve('/foo/bar', './baz'));15console.log(path.resolve('/foo/bar', '/tmp/file/'));16console.log(path.resolve('wwwroot', 'static_files/png/', '../gif/image.gif'));

Full Screen

Using AI Code Generation

copy

Full Screen

1var path = require('path');2console.log('file name : '+path.basename(__filename));3console.log('directory name : '+path.dirname(__filename));4console.log('file extension : '+path.extname(__filename));5console.log('path object : '+path.parse(__filename));6console.log('path object root : '+path.parse(__filename).root);7console.log('path object base : '+path.parse(__filename).base);8console.log('path object name : '+path.parse(__filename).name);9console.log('path object ext : '+path.parse(__filename).ext);10console.log('path object dir : '+path.parse(__filename).dir);11console.log('path object : '+path.parse(__filename));12console.log('join path : '+path.join(__dirname,'test','hello.html'));13var path = require('path').posix;14console.log('file name : '+path.basename(__filename));15console.log('directory name : '+path.dirname(__filename));16console.log('file extension : '+path.extname(__filename));17console.log('path object : '+path.parse(__filename));18console.log('path object root : '+path.parse(__filename).root);19console.log('path object base : '+path.parse(__filename).base);20console.log('path object name : '+path.parse(__filename).name);21console.log('path object ext : '+path.parse(__filename).ext);22console.log('path object dir : '+path.parse(__filename).dir);23console.log('path object : '+path.parse(__filename));24console.log('join path : '+path.join(__dirname,'test','hello.html'));

Full Screen

Using AI Code Generation

copy

Full Screen

1var path = require('path');2var rootPath = path.parse(__dirname).root;3console.log(rootPath);4var path = require('path');5var rootPath = path.parse(__dirname).root;6console.log(rootPath);7var path = require('path');8var rootPath = path.parse(__dirname).root;9console.log(rootPath);10var path = require('path');11var rootPath = path.parse(__dirname).root;12console.log(rootPath);13var path = require('path');14var rootPath = path.parse(__dirname).root;15console.log(rootPath);16var path = require('path');17var rootPath = path.parse(__dirname).root;18console.log(rootPath);19var path = require('path');20var rootPath = path.parse(__dirname).root;21console.log(rootPath);22var path = require('path');23var rootPath = path.parse(__dirname).root;24console.log(rootPath);25var path = require('path');26var rootPath = path.parse(__dirname).root;27console.log(rootPath);28var path = require('path');29var rootPath = path.parse(__dirname).root;30console.log(rootPath);31var path = require('path');32var rootPath = path.parse(__dirname).root;33console.log(rootPath);34var path = require('path');35var rootPath = path.parse(__dirname).root;36console.log(rootPath);37var path = require('path');38var rootPath = path.parse(__dirname).root;39console.log(rootPath);40var path = require('path');41var rootPath = path.parse(__dirname).root;42console.log(rootPath);

Full Screen

Using AI Code Generation

copy

Full Screen

1var path = require('path');2var rootPath = path.normalize(__dirname + '/../../');3module.exports = {4 development: {5 },6 production: {7 }8}

Full Screen

Using AI Code Generation

copy

Full Screen

1const path = require('path');2var root = path.parse(process.cwd()).root;3console.log(root);4const path = require('path');5var root = path.parse(process.cwd()).root;6console.log(root);7const path = require('path');8var root = path.parse(process.cwd()).root;9console.log(root);10const path = require('path');11var root = path.parse(process.cwd()).root;12console.log(root);13const path = require('path');14var root = path.parse(process.cwd()).root;15console.log(root);16const path = require('path');17var root = path.parse(process.cwd()).root;18console.log(root);19const path = require('path');20var root = path.parse(process.cwd()).root;21console.log(root);22const path = require('path');23var root = path.parse(process.cwd()).root;24console.log(root);25const path = require('path');26var root = path.parse(process.cwd()).root;27console.log(root);28const path = require('path');29var root = path.parse(process.cwd()).root;30console.log(root);31const path = require('path');32var root = path.parse(process.cwd()).root;33console.log(root);34const path = require('path');35var root = path.parse(process.cwd()).root;36console.log(root);37const path = require('path');38var root = path.parse(process.cwd()).root;39console.log(root);40const path = require('path');41var root = path.parse(process.cwd()).root;42console.log(root);43const path = require('path');44var root = path.parse(process.cwd

Full Screen

Using AI Code Generation

copy

Full Screen

1const path = require('path');2const rootPath = path.parse(__dirname).root;3console.log(rootPath);4const path = require('path');5const rootPath = path.parse(__dirname).root;6console.log(rootPath);7const path = require('path');8const rootPath = path.parse(__dirname).root;9console.log(rootPath);10const path = require('path');11const rootPath = path.parse(__dirname).root;12console.log(rootPath);13const path = require('path');14const rootPath = path.parse(__dirname).root;15console.log(rootPath);16const path = require('path');17const rootPath = path.parse(__dirname).root;18console.log(rootPath);19const path = require('path');20const rootPath = path.parse(__dirname).root;21console.log(rootPath);22const path = require('path');23const rootPath = path.parse(__dirname).root;24console.log(rootPath);25const path = require('path');26const rootPath = path.parse(__dirname).root;27console.log(rootPath);28const path = require('path');29const rootPath = path.parse(__dirname).root;30console.log(rootPath);31const path = require('path');32const rootPath = path.parse(__dirname).root;33console.log(rootPath);34const path = require('path');35const rootPath = path.parse(__dirname).root;36console.log(rootPath);37const path = require('path');38const rootPath = path.parse(__dirname).root;39console.log(rootPath);

Full Screen

Using AI Code Generation

copy

Full Screen

1var root = '/';2var temp = '/tmp';3var home = process.env.HOME;4var appData = process.env.HOME + '/.config';5var userData = process.env.HOME + '/.config';6var localAppData = process.env.HOME + '/.local/share';7var desktop = process.env.HOME + '/Desktop';8var documents = process.env.HOME + '/Documents';9var music = process.env.HOME + '/Music';10var pictures = process.env.HOME + '/Pictures';11var videos = process.env.HOME + '/Videos';

Full Screen

Using AI Code Generation

copy

Full Screen

1const path = require('path');2console.log(path.win32.parse("C:\\Users\\sudhe\\Desktop\\nodejs\\nodejs\\test.js"));3const path = require('path');4console.log(path.posix.parse("C:\\Users\\sudhe\\Desktop\\nodejs\\nodejs\\test.js"));5const path = require('path');6console.log(path.join("C:\\Users\\sudhe\\Desktop\\nodejs\\nodejs\\test.js"));7const path = require('path');8console.log(path.normalize("C:\\Users\\sudhe\\Desktop\\nodejs\\nodejs\\test.js"));9const path = require('path');10console.log(path.resolve("C:\\Users\\sudhe\\Desktop\\nodejs\\nodejs\\test.js"));11const path = require('path');12console.log(path.win32.parse("C:\\Users\\sudhe\\Desktop\\nodejs\\nodejs\\test.js"));13const path = require('path');14console.log(path.posix.parse("C:\\Users\\sudhe\\Desktop\\nodejs\\nodejs\\test.js"));15const path = require('path');16console.log(path.join("C:\\Users\\sudhe\\Desktop\\nodejs\\nodejs\\test.js"));17const path = require('path');18console.log(path.normalize("C:\\Users\\sudhe\\Desktop\\nodejs\\nodejs\\test.js"));19const path = require('path');20console.log(path.resolve("C:\\Users\\sudhe\\Desktop\\nodejs\\nodejs\\test.js"));21const path = require('path');22console.log(path.win32.parse("C:\\Users\\sudhe\\Desktop\\nodejs\\nodejs\\test.js"));23const path = require('path');24console.log(path.posix.parse("C:\\Users\\sudhe\\

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run root 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