Skip to content

Commit

Permalink
Merge branch 'no-addressof' into shell_notify_icon_example
Browse files Browse the repository at this point in the history
  • Loading branch information
ilopX authored Jan 19, 2021
2 parents c8f936e + 9538d9a commit 543312a
Show file tree
Hide file tree
Showing 17 changed files with 2,859 additions and 1,875 deletions.
3 changes: 3 additions & 0 deletions lib/src/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,9 @@ const FORMAT_MESSAGE_MAX_WIDTH_MASK = 0x000000FF;
// WindowStyle constants
// -----------------------------------------------------------------------------

/// The window is active.
const WS_ACTIVECAPTION = 0x0001;

/// The window has a thin-line border.
const WS_BORDER = 0x00800000;

Expand Down
62 changes: 31 additions & 31 deletions lib/src/kernel32.dart
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,22 @@ int FindFirstVolume(Pointer<Utf16> lpszVolumeName, int cchBufferLength) {
return _FindFirstVolume(lpszVolumeName, cchBufferLength);
}

/// Requests that the operating system signal a change notification handle
/// the next time it detects an appropriate change.
///
/// ```c
/// BOOL FindNextChangeNotification(
/// HANDLE hChangeHandle
/// );
/// ```
/// {@category kernel32}
int FindNextChangeNotification(int hChangeHandle) {
final _FindNextChangeNotification = _kernel32.lookupFunction<
Int32 Function(IntPtr hChangeHandle),
int Function(int hChangeHandle)>('FindNextChangeNotification');
return _FindNextChangeNotification(hChangeHandle);
}

/// Continues a file search from a previous call to the FindFirstFile,
/// FindFirstFileEx, or FindFirstFileTransacted functions.
///
Expand All @@ -757,22 +773,6 @@ int FindNextFile(int hFindFile, Pointer<WIN32_FIND_DATA> lpFindFileData) {
return _FindNextFile(hFindFile, lpFindFileData);
}

/// Requests that the operating system signal a change notification handle
/// the next time it detects an appropriate change.
///
/// ```c
/// BOOL FindNextChangeNotification(
/// HANDLE hChangeHandle
/// );
/// ```
/// {@category kernel32}
int FindNextChangeNotification(int hChangeHandle) {
final _FindNextChangeNotification = _kernel32.lookupFunction<
Int32 Function(IntPtr hChangeHandle),
int Function(int hChangeHandle)>('FindNextChangeNotification');
return _FindNextChangeNotification(hChangeHandle);
}

/// Continues a volume search started by a call to the FindFirstVolume
/// function. FindNextVolume finds one volume per call.
///
Expand Down Expand Up @@ -1880,21 +1880,6 @@ int ReadProcessMemory(int hProcess, Pointer lpBaseAddress, Pointer lpBuffer,
hProcess, lpBaseAddress, lpBuffer, nSize, lpNumberOfBytesRead);
}

/// Deletes an existing empty directory.
///
/// ```c
/// BOOL RemoveDirectoryW(
/// LPCWSTR lpPathName
/// );
/// ```
/// {@category kernel32}
int RemoveDirectory(Pointer<Utf16> lpPathName) {
final _RemoveDirectory = _kernel32.lookupFunction<
Int32 Function(Pointer<Utf16> lpPathName),
int Function(Pointer<Utf16> lpPathName)>('RemoveDirectoryW');
return _RemoveDirectory(lpPathName);
}

/// The ReleaseActCtx function decrements the reference count of the
/// specified activation context.
///
Expand All @@ -1910,6 +1895,21 @@ void ReleaseActCtx(int hActCtx) {
return _ReleaseActCtx(hActCtx);
}

/// Deletes an existing empty directory.
///
/// ```c
/// BOOL RemoveDirectoryW(
/// LPCWSTR lpPathName
/// );
/// ```
/// {@category kernel32}
int RemoveDirectory(Pointer<Utf16> lpPathName) {
final _RemoveDirectory = _kernel32.lookupFunction<
Int32 Function(Pointer<Utf16> lpPathName),
int Function(Pointer<Utf16> lpPathName)>('RemoveDirectoryW');
return _RemoveDirectory(lpPathName);
}

/// Resizes the internal buffers for a pseudoconsole to the given size.
///
/// ```c
Expand Down
58 changes: 29 additions & 29 deletions lib/src/shell32.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,27 @@ int FindExecutable(Pointer<Utf16> lpFile, Pointer<Utf16> lpDirectory,
return _FindExecutable(lpFile, lpDirectory, lpResult);
}

/// Creates and initializes a Shell item object from a parsing name.
///
/// ```c
/// SHSTDAPI SHCreateItemFromParsingName(
/// PCWSTR pszPath,
/// IBindCtx *pbc,
/// REFIID riid,
/// void **ppv
/// );
/// ```
/// {@category shell32}
int SHCreateItemFromParsingName(Pointer<Utf16> pszPath, Pointer pbc,
Pointer<GUID> riid, Pointer<Pointer> ppv) {
final _SHCreateItemFromParsingName = _shell32.lookupFunction<
Int32 Function(Pointer<Utf16> pszPath, Pointer pbc, Pointer<GUID> riid,
Pointer<Pointer> ppv),
int Function(Pointer<Utf16> pszPath, Pointer pbc, Pointer<GUID> riid,
Pointer<Pointer> ppv)>('SHCreateItemFromParsingName');
return _SHCreateItemFromParsingName(pszPath, pbc, riid, ppv);
}

/// Displays a ShellAbout dialog box.
///
/// ```c
Expand All @@ -60,21 +81,6 @@ int ShellAbout(
return _ShellAbout(hWnd, szApp, szOtherStuff, hIcon);
}

/// Performs an operation on a specified file.
///
/// ```c
/// BOOL ShellExecuteExW(
/// SHELLEXECUTEINFOW *pExecInfo
/// );
/// ```
/// {@category shell32}
int ShellExecuteEx(Pointer<SHELLEXECUTEINFO> pExecInfo) {
final _ShellExecuteEx = _shell32.lookupFunction<
Int32 Function(Pointer<SHELLEXECUTEINFO> pExecInfo),
int Function(Pointer<SHELLEXECUTEINFO> pExecInfo)>('ShellExecuteExW');
return _ShellExecuteEx(pExecInfo);
}

/// Performs an operation on a specified file.
///
/// ```c
Expand Down Expand Up @@ -109,25 +115,19 @@ int ShellExecute(int hwnd, Pointer<Utf16> lpOperation, Pointer<Utf16> lpFile,
hwnd, lpOperation, lpFile, lpParameters, lpDirectory, nShowCmd);
}

/// Creates and initializes a Shell item object from a parsing name.
/// Performs an operation on a specified file.
///
/// ```c
/// SHSTDAPI SHCreateItemFromParsingName(
/// PCWSTR pszPath,
/// IBindCtx *pbc,
/// REFIID riid,
/// void **ppv
/// BOOL ShellExecuteExW(
/// SHELLEXECUTEINFOW *pExecInfo
/// );
/// ```
/// {@category shell32}
int SHCreateItemFromParsingName(Pointer<Utf16> pszPath, Pointer pbc,
Pointer<GUID> riid, Pointer<Pointer> ppv) {
final _SHCreateItemFromParsingName = _shell32.lookupFunction<
Int32 Function(Pointer<Utf16> pszPath, Pointer pbc, Pointer<GUID> riid,
Pointer<Pointer> ppv),
int Function(Pointer<Utf16> pszPath, Pointer pbc, Pointer<GUID> riid,
Pointer<Pointer> ppv)>('SHCreateItemFromParsingName');
return _SHCreateItemFromParsingName(pszPath, pbc, riid, ppv);
int ShellExecuteEx(Pointer<SHELLEXECUTEINFO> pExecInfo) {
final _ShellExecuteEx = _shell32.lookupFunction<
Int32 Function(Pointer<SHELLEXECUTEINFO> pExecInfo),
int Function(Pointer<SHELLEXECUTEINFO> pExecInfo)>('ShellExecuteExW');
return _ShellExecuteEx(pExecInfo);
}

/// Empties the Recycle Bin on the specified drive.
Expand Down
71 changes: 71 additions & 0 deletions lib/src/structs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,38 @@ class PHYSICAL_MONITOR extends Struct {
external int _data14;
@Uint64()
external int _data15;
@Uint64()
external int _data16;
@Uint64()
external int _data17;
@Uint64()
external int _data18;
@Uint64()
external int _data19;
@Uint64()
external int _data20;
@Uint64()
external int _data21;
@Uint64()
external int _data22;
@Uint64()
external int _data23;
@Uint64()
external int _data24;
@Uint64()
external int _data25;
@Uint64()
external int _data26;
@Uint64()
external int _data27;
@Uint64()
external int _data28;
@Uint64()
external int _data29;
@Uint64()
external int _data30;
@Uint64()
external int _data31;
}

extension PointerPHYSICAL_MONITORExtension on Pointer<PHYSICAL_MONITOR> {
Expand Down Expand Up @@ -1779,6 +1811,45 @@ class CREDENTIAL extends Struct {
external Pointer<Utf16> UserName;
}

// typedef struct tagWINDOWINFO {
// DWORD cbSize;
// RECT rcWindow;
// RECT rcClient;
// DWORD dwStyle;
// DWORD dwExStyle;
// DWORD dwWindowStatus;
// UINT cxWindowBorders;
// UINT cyWindowBorders;
// ATOM atomWindowType;
// WORD wCreatorVersion;
// } WINDOWINFO, *PWINDOWINFO, *LPWINDOWINFO;

/// Contains window information.
///
/// {@category Struct}
class WINDOWINFO extends Struct {
@Uint32()
external int cbSize;

external RECT rcWindow;
external RECT rcClient;

@Uint32()
external int dwStyle;
@Uint32()
external int dwExStyle;
@Uint32()
external int dwWindowStatus;
@Uint32()
external int cxWindowBorders;
@Uint32()
external int cyWindowBorders;
@Uint16()
external int atomWindowType;
@Uint16()
external int wCreatorVersion;
}

// *** CONSOLE STRUCTS ***

// Dart FFI does not yet have support for nested structs, so there's extra
Expand Down
Loading

0 comments on commit 543312a

Please sign in to comment.