-
Notifications
You must be signed in to change notification settings - Fork 0
Methods
Producer functions make calls to WinRT and supported Win32 API's to get relevant system, user and hardware information. After retrieving this information, these functions format and store the data in a given cylonStruct.
-
void produceUsername(struct cylonStruct& tf)
-
This function calls the Windows UserInformation GetDisplayNameAsync() method to retrieve the username of the current logged in user. To allow rapid refreshes of a cylonStruct, a blocking loop prevents the function from proceeding until the asynchronous response has replied with a result. Finally, the function converts the result into a wstring and stores it in the provided cylonStruct.
-
void produceTimeZone(struct cyclonStruct& tory)
-
This function calls the Windows method GetTimeZoneInformation, and stores the received bias and time zone names in the given cylonStruct. Additionally, a conversion is done on the DWORD result of the GetTimeZoneInformation call, and the result is stored as the dst member variable of the cylonStruct.
-
void produceDateTime(struct cylonStruct& tory)
-
This function calls the Windows method GetLocalTime, and stores the resulting responses for hours, minutes, seconds, milliseconds, day, date, month, and year in the provided cylonStruct.
-
void produceDeviceName(struct cylonStruct& tory)
-
This function calls a Windows socket WSAStartup, and makes a request for the host's name via gethostname. After receiving the host name, WSACleanup() is called. The method then converts the host name to a wstring and stores it in the provided cylonStruct.
-
void produceProcessorInfo(struct cylonStruct& tf)
-
This function calls the Windows GetNativeSystemInfo method and fills a local SYSTEM_INFO object. The cylonStruct's processor architecture variable is set via an if-else interpretation of that object's wProcessorArchitecture enum. Additionally, the cylonStruct's pageSize, minAppAddress, maxAppAddress, processorCount, and allocationGranularity are all gleaned from the SYSTEM_INFO object. Various other fields that are currently unused in the Windows 8.1 portion of the Final Five project are set to default values (i.e. lowMemory, etc.).
-
void produceMemoryInfo(struct cylonStruct& tf)
-
Due to constraints on Windows RT, this function checks for the presence of the IsWow64Process() function in the Kernel32.lib (traditionally unaccessible by WinRT apps). If the Kernel function is not located, the given cylonStruct's architecture is set to 32-bit and a minimum RAM of 1GB. If the function is located, a call is made using the current process. If the value returned is true, the architecture is set to 64-bit and a minimum RAM of 2GB, otherwise, both values default to the 32-bit/1GB scheme.
-
void produceAccountPicture(struct cylonStruct& tf)
-
This function retrieves the SmallImage format of the account picture for the presently logged-in user on the current machine. For debugging purposes, the image's file type extension is also retrieved and converted into a wstring. Both of these objects are then stored in the provided cylonStruct for later use. Additionally, the picturePath field of the given cylonStruct is set to the Path field of the retrieved picture object.
-
void produceDeviceTypeInformation(struct cylonStruct& tf, std::string type)
-
This function retrieves a DeviceInformationCollection^ object like the previous method, but can filter results based on type (video capture, audio capture, audio render, image scanner, location aware, portable storage device, or all, where all recreates the results of the previous method). It then creates a deviceStruct object for each device in the collection and stores it in the master device list of the given cylonStruct.
-
void produceDeviceTypesInformation(struct cylonStruct& tf)
-
This function calls produceDeviceTypeInformation for video capture, audio capture, audio render, location aware, portable storage, and image scanning devices. Following this it calls the additional producers for display, mouse, keyboard, and controller devices before finally updating the cylonStruct's detectedDevices count to be the size of the master device's list.
-
void produceDisplayInformation(struct cylonStruct& tf)
-
This function creates a new instance of a displayStruct (for storing the metadata of the primary display device) using the Windows DisplayInformation class, and creates an additional "parent" deviceStruct to represent the displayStruct within the master list of devices. The deviceStruct's displayIndex value is set to the current size of the display devices list of the provided cylonStruct, and then both of the created structures are stored within the appropriately typed lists of the cylonStruct.
-
void produceMouseInformation(struct cylonStruct& tf)
-
This function creates a new instance of a mouseStruct (for storing the metadata of all the available mice for the current machine) using the Windows MouseCapabilities class, and creates an additional "parent" deviceStruct to represent the mouseStruct in the master list of devices. The deviceStruct is then inserted into the devices list for the provided cylonStruct.
-
void produceKeyboardInformation(struct cylonStruct& tf)
-
This function creates a new deviceStruct and stores it in the master devices list, but only if a keyboard is found via the Windows KeyboardCapabilities class.
-
void produceControllerInformation(struct cylonStruct& tf)
-
This function iterates over all possible values of userIndex for XInput, ranging from 0 to XUSER_MAX_COUNT. For each index, XInputGetState() is called. If the result is successful for that index, a controllerStruct is created and filled with the appropriate metadata from the provided XINPUT_STATE object, as well as a "parent" deviceStruct to represent the controller in the master devices list for the given cylonStruct. The deviceStruct's controllerIndex is set to the size of the controllers list for the cylonStruct, and then both objects are inserted into the appropriate lists.
-
void produceTory(struct cylonStruct& tf)
-
This function calls all other producer functions on a given cylonStruct.
Builder functions are similar to constructors. They call various producers to create an object, and then return the fully formed structure for consumption by another method.
-
struct cylonStruct buildTory()
-
This function acts similar to a constructor for a cylonStruct. The struct is initialized and then filled many of the above producer methods, finally returning the new cylonStruct.
-
struct deviceStruct buildDevice(Windows::Devices::Enumeration::DeviceInformation^ deviceInfo, unsigned int deviceType)
-
This function acts similar to a constructor for a deviceStruct. If the provided type is for a display, mouse, keyboard, or controller, a short if clause creates a "default" definition for these device types, and then returns immediately. Otherwise, the provided deviceInfo object is probed and any metadata retrieved is stored before returning the new struct. Fields that are not used in the Windows 8.1 context of the Final Five project (like vendorID) are set to a default.
-
struct controllerStruct buildController(struct deviceStruct superDevice, XINPUT_STATE state, DWORD userIndex)
-
This function acts similar to a constructor for a controllerStruct. It initializes a new controllerStruct, and then populates that struct with acquired values for the provided userIndex, superDevice, and state objects before finally returning the new struct.
-
struct buildDisplay(struct deviceStruct superDevice, Windows::Graphics::Display::DisplayInformation^ displayInformation)
-
This function acts similar to a constructor for a displayStruct. It initializes a new displayStruct, and then populates that struct with acquired values for the provided superDevice and displayInformation objects before finally returning the new struct.
-
struct buildStorage(Windows::Devices::Enumeration::DeviceInformation^ deviceInfo, struct deviceStruct superDevice)
-
This function acts similar to a constructor for a storageStruct. It initializes a new storageStruct, and then populates that struct with acquired values from the provided superDevice and deviceInfo objects before finally returning the new struct. Fields that are unused in the Windows 8.1 portion of the Final Five project are set to a default value.
-
std::string utf8_encode(const std::wstring &wstr)
-
This function converts a given wstring to a utf8 encoded std::string. Via tfinniga at stackoverflow.
-
std::wstring utf8_decode(const std::string &str)
-
This function converts a given string to a wstring. Via tfinniga at stackoverflow.
- HMODULE GetKernelModule()
- This function allows produceMemoryInformation() to access Kernel32.lib from the WinRT context. For more information, please see the Ted's Blog article on how this method works.