Skip to content

Latest commit

 

History

History
804 lines (389 loc) · 19.4 KB

wincerapi.md

File metadata and controls

804 lines (389 loc) · 19.4 KB

wincerapi

Module wincerapi

A module which provides an interface to the win32 CE Remote API

Methods

wincerapi.CEHANDLE

PyCEHANDLE = CEHANDLE() Creates a new CEHANDLE object

CSIDL_BITBUCKET

const wincerapi.CSIDL_BITBUCKET;

Recycle bin-file system directory containing file objects in the user's recycle bin. The location of this directory is not in the registry; it is marked with the hidden and system attributes to prevent the user from moving or deleting it.

CSIDL_COMMON_DESKTOPDIRECTORY

const wincerapi.CSIDL_COMMON_DESKTOPDIRECTORY;

File system directory that contains files and folders that appear on the desktop for all users.

CSIDL_COMMON_PROGRAMS

const wincerapi.CSIDL_COMMON_PROGRAMS;

File system directory that contains the directories for the common program groups that appear on the Start menu for all users.

CSIDL_COMMON_STARTMENU

const wincerapi.CSIDL_COMMON_STARTMENU;

File system directory that contains the programs and folders that appear on the Start menu for all users.

CSIDL_COMMON_STARTUP

const wincerapi.CSIDL_COMMON_STARTUP;

File system directory that contains the programs that appear in the Startup folder for all users. The system starts these programs whenever any user logs on to a Windows desktop platform.

CSIDL_CONTROLS

const wincerapi.CSIDL_CONTROLS;

Control Panel-virtual folder containing icons for the control panel applications.

CSIDL_DESKTOP

const wincerapi.CSIDL_DESKTOP;

Windows desktop-virtual folder at the root of the name space.

CSIDL_DESKTOPDIRECTORY

const wincerapi.CSIDL_DESKTOPDIRECTORY;

File system directory used to physically store file objects on the desktop - not to be confused with the desktop folder itself.

CSIDL_DRIVES

const wincerapi.CSIDL_DRIVES;

My Computer-virtual folder containing everything on the local computer: storage devices, printers, and Control Panel. The folder can also contain mapped network drives.

CSIDL_FONTS

const wincerapi.CSIDL_FONTS;

Virtual folder containing fonts.

CSIDL_NETHOOD

const wincerapi.CSIDL_NETHOOD;

File system directory containing objects that appear in the network neighborhood.

CSIDL_NETWORK

const wincerapi.CSIDL_NETWORK;

Network Neighborhood-virtual folder representing the top level of the network hierarchy.

CSIDL_PERSONAL

const wincerapi.CSIDL_PERSONAL;

File system directory that serves as a common repository for documents.

CSIDL_PRINTERS

const wincerapi.CSIDL_PRINTERS;

Printers folder-virtual folder containing installed printers.

CSIDL_PROGRAMS

const wincerapi.CSIDL_PROGRAMS;

File system directory that contains the user's program groups which are also file system directories.

CSIDL_RECENT

const wincerapi.CSIDL_RECENT;

File system directory containing the user's most recently used documents.

CSIDL_SENDTO

const wincerapi.CSIDL_SENDTO;

File system directory containing Send To menu items.

CSIDL_STARTMENU

const wincerapi.CSIDL_STARTMENU;

File system directory containing Start menu items.

CSIDL_STARTUP

const wincerapi.CSIDL_STARTUP;

File system directory that corresponds to the user's Startup program group.

CSIDL_TEMPLATES

const wincerapi.CSIDL_TEMPLATES;

File system directory that serves as a common repository for document templates.

wincerapi.CeCheckPassword

CeCheckPassword(password) This function compares a specified string to the system password.

Parameters

  • password : PyUnicode

    The password to compare.

wincerapi.CeCopyFile

CeCopyFile(from, to, bFailIfExists) Copies a file

Parameters

  • from : PyUnicode

    The name of the file to copy from

  • to : PyUnicode

    The name of the file to copy to

  • bFailIfExists : int

    Indicates if the operation should fail if the file exists.

wincerapi.CeCreateDirectory

CeCreateDirectory(name, sa) Creates a directory

Parameters

wincerapi.CeCreateFile

PyCEHANDLE = CeCreateFile(fileName, desiredAccess

, shareMode

, attributes

, creationDisposition

, flagsAndAttributes

, hTemplateFile

) Creates or opens the a file or other object and returns a handle that can be used to access the object.

Parameters

  • fileName : PyUnicode

    The name of the file

  • desiredAccess : int

    access (read-write) mode

Specifies the type of access to the object. An application can obtain read access, write access, read-write access, or device query access. This parameter can be any combination of the following values.

   Value





   Meaning

0Specifies device query access to the object. An application can query device attributes without accessing the device.

GENERIC_READSpecifies read access to the object. Data can be read from the file and the file pointer can be moved. Combine with GENERIC_WRITE for read-write access.

GENERIC_WRITESpecifies write access to the object. Data can be written to the file and the file pointer can be moved. Combine with GENERIC_READ for read-write access.

  • shareMode : int

    Set of bit flags that specifies how the object can be shared. If dwShareMode is 0, the object cannot be shared. Subsequent open operations on the object will fail, until the handle is closed.

To share the object, use a combination of one or more of the following values:

   Value





   Meaning

FILE_SHARE_DELETEWindows NT: Subsequent open operations on the object will succeed only if delete access is requested.

FILE_SHARE_READSubsequent open operations on the object will succeed only if read access is requested.

FILE_SHARE_WRITESubsequent open operations on the object will succeed only if write access is requested.

  • attributes : PySECURITY_ATTRIBUTES

    The security attributes, or None

  • creationDisposition : int

    Specifies which action to take on files that exist, and which action to take when files do not exist. For more information about this parameter, see the Remarks section. This parameter must be one of the following values:

    Value

    Meaning

CREATE_NEWCreates a new file. The function fails if the specified file already exists.

CREATE_ALWAYSCreates a new file. If the file exists, the function overwrites the file and clears the existing attributes.

OPEN_EXISTINGOpens the file. The function fails if the file does not exist.

See the Remarks section for a discussion of why you should use the OPEN_EXISTING flag if you are using the CreateFile function for devices, including the console.

OPEN_ALWAYSOpens the file, if it exists. If the file does not exist, the function creates the file as if dwCreationDisposition were CREATE_NEW.

TRUNCATE_EXISTINGOpens the file. Once opened, the file is truncated so that its size is zero bytes. The calling process must open the file with at least GENERIC_WRITE access. The function fails if the file does not exist.

  • flagsAndAttributes : int

    file attributes

  • hTemplateFile : PyHANDLE

    Specifies a handle with GENERIC_READ access to a template file. The template file supplies file attributes and extended attributes for the file being created. Under Win95, this must be 0, else an exception will be raised.

Comments

The following objects can be opened: files pipes mailslots communications resources disk devices (Windows NT only) consoles directories (open only)

wincerapi.CeDeleteFile

CeDeleteFile(fileName) Deletes a file.

Parameters

  • fileName : PyUnicode

    The filename to delete

wincerapi.CeGetDesktopDeviceCaps

int = CeGetDesktopDeviceCaps() Retrieves information about the CE desktop.

wincerapi.CeGetFileAttributes

int = CeGetFileAttributes(fileName) Determines a files attributes.

Parameters

  • fileName : PyUnicode

    Name of the file to retrieve attributes for.

wincerapi.CeGetFileSize

PyLARGE_INTEGER

= CeGetFileSize() Determines the size of a file.

wincerapi.CeGetSpecialFolderPath

PyUnicode = CeGetSpecialFolderPath() Retrieves the location of special folders on the CE device.

wincerapi.CeGetStoreInformation

int, int = CeGetStoreInformation() Retrieves information about store on the CE system.

Return Value

The result is a tuple of (storeSize, freeSize)

wincerapi.CeGetSystemInfo

tuple = CeGetSystemInfo() Retrieves information about the CE device.

Win32 API References

Return Value

The return value is a tuple of 9 values, which corresponds

to the Win32 SYSTEM_INFO structure. The element names are:

dwOemId dwPageSize lpMinimumApplicationAddress lpMaximumApplicationAddress ,

dwActiveProcessorMask dwNumberOfProcessors

dwProcessorType dwAllocationGranularity (wProcessorLevel,wProcessorRevision)

wincerapi.CeGetSystemMetrics

int = CeGetSystemMetrics() Retrieves information about the CE system.

wincerapi.CeGetSystemPowerStatusEx

tuple = CeGetSystemPowerStatusEx() Retrieves the power status of the CE device.

Return Value

The result is a tuple of (ACLineStatus, BatteryFlag, BatteryLifePercent, BatteryLifeTime, BatteryFullLifeTime, BackupBatteryFlag, BackupBatteryLifePercent, BackupBatteryLifeTime, BackupBatteryLifeTime);

wincerapi.CeGetTempPath

PyUnicode = CeGetTempPath() Obtains the temp path on the device.

wincerapi.CeGetVersionEx

(int,int,int,int,string) = CeGetVersionEx() Returns the current version of Windows, and information about the environment for the CE device.

Return Value

The return value is a tuple with the following information.

wincerapi.CeGlobalMemoryStatus

tuple = CeGlobalMemoryStatus() Returns information about current memory availability.

Return Value

The return value is a tuple with the following information.

wincerapi.CeMoveFile

CeMoveFile(existingFileName, newFileName) Renames an existing file or a directory (including all its children).

Parameters

  • existingFileName : PyUnicode

    Name of the existing file

  • newFileName : PyUnicode

    New name for the file

wincerapi.CeRapiInit

CeRapiInit() Initializes the remote API.

wincerapi.CeRapiInitEx

int = CeRapiInitEx() Initializes the remote API asynchronously.

wincerapi.CeRapiUninit

CeRapiUninit() UnInitializes the remote API.

wincerapi.CeReadFile

string = CeReadFile(hFile, bufSize

) Reads a file from the CE device.

Parameters

  • hFile : PyHANDLE/int

    Handle to the file

  • bufSize : int

    Size of the buffer to create for the read.

wincerapi.CeRemoveDirectory

CeRemoveDirectory(lpPathName) Removes an existing directory

Parameters

  • lpPathName : PyUnicode

    Name of the path to remove.

wincerapi.CeSHCreateShortcut

CeSHCreateShortcut() Creates a shortcut on the remote device.

wincerapi.CeSHGetShortcutTarget

tuple = CeSHGetShortcutTarget() Retrieves the target of a shortcut.

wincerapi.CeSetFileAttributes

CeSetFileAttributes(filename, newAttributes) Changes a file's attributes.

Parameters

  • filename : PyUnicode

    filename

  • newAttributes : int

    attributes to set

wincerapi.CreateProcess

PyHANDLE, PyHANDLE, int, int = CreateProcess(appName, commandLine

, processAttributes

, threadAttributes

, bInheritHandles

, dwCreationFlags

, newEnvironment

, currentDirectory

, startupinfo

) Creates a new process and its primary thread. The new process executes the specified executable file.

Parameters

  • appName : string

    name of executable module, or None

  • commandLine : string

    command line string, or None

  • processAttributes : PySECURITY_ATTRIBUTES

    process security attributes, or None

  • threadAttributes : PySECURITY_ATTRIBUTES

    thread security attributes, or None

  • bInheritHandles : int

    handle inheritance flag

  • dwCreationFlags : int

    creation flags

  • newEnvironment : None

    A dictionary of stringor Unicode pairs to define the environment for the process, or None to inherit the current environment.

  • currentDirectory : string

    current directory name, or None

  • startupinfo : PySTARTUPINFO

    a STARTUPINFO object that specifies how the main window for the new process should appear.

Comments

The result is a tuple of (hProcess, hThread, dwProcessId, dwThreadId)

wincerapi.FindFiles

list = FindFiles(fileSpec) Retrieves a list of matching filenames on the CE device. An interface to the API CeFindFirstFile/CeFindNextFile functions.

Parameters

  • fileSpec : PyUnicode

    A string that specifies a valid directory or path and filename, which can contain wildcard characters (* and ?).

Win32 API References

Return Value

The return value is a list of tuples, in the same format as the WIN32_FIND_DATA structure:

Items

  • [0] int : attributes

    File Attributes. A combination of the win32com.FILE_ATTRIBUTE_* flags.

  • [1] PyTime : createTime

    File creation time.

  • [2] PyTime : accessTime

    File access time.

  • [3] PyTime : writeTime

    Time of last file write

  • [4] int : nFileSizeHigh

    high order word of file size.

  • [5] int : nFileSizeLow

    low order word of file size.

  • [6] int : OID

    The object identifier for the file

  • [7] int : zero

    Filler

  • [8] string : fileName

    The name of the file.

  • [9] None : altName

    Always None

wincerapi.WriteFile

int, int = WriteFile(hFile, data

) Writes a string to a file

Parameters

  • hFile : PyHANDLE/int

    Handle to the file

  • data : string

    The data to write.

Return Value

The result is a tuple of (errCode, nBytesWritten).

errCode will always be zero (until overlapped IO is supported!)