Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple PID Support #24

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix compile warnings
dlardo committed Nov 23, 2023
commit d994b19c8c85cb1b5154f7fce0f6ed31bff57484
2 changes: 2 additions & 0 deletions Main.c
Original file line number Diff line number Diff line change
@@ -4,6 +4,8 @@
// [email protected]
// https://github.com/ryanries/UniversalPauseButton/

#pragma warning(disable: 5045) // Spectre memory vulnerability warnings

#ifndef UNICODE
#define UNICODE
#endif
11 changes: 6 additions & 5 deletions Main.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#pragma warning(disable:4820) // padding in structures
#pragma warning(disable:4711) // automatic inline expansion

#include "Globals.h"

@@ -28,11 +29,11 @@ _HungWindowFromGhostWindow HungWindowFromGhostWindow;
// Configurable registry settings.
typedef struct _CONFIG
{
u32 Debug;
u32 TrayIcon;
u32 PauseKey;
const wchar_t ProcessNameToPause[128];
const wchar_t ProcessNameListToPause[MAX_PROCESSES * 128];
u32 Debug;
u32 TrayIcon;
u32 PauseKey;
wchar_t ProcessNameToPause[128];
wchar_t ProcessNameListToPause[MAX_PROCESSES * 128];
} CONFIG;

// Function declarations.
9 changes: 5 additions & 4 deletions set.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#pragma warning(disable: 5045) // Spectre memory vulnerability warnings

#include "set.h"
#include <stdio.h>
@@ -10,7 +11,7 @@ void initializeSet(Set* set) {
set->size = 0;
}

bool addToSet(Set* set, int element) {
bool addToSet(Set* set, u32 element) {
// Check if the element is already in the set
for (size_t i = 0; i < set->size; i++) {
if (set->elements[i] == element) {
@@ -28,7 +29,7 @@ bool addToSet(Set* set, int element) {
}
}

bool removeFromSet(Set* set, int element) {
bool removeFromSet(Set* set, u32 element) {
for (size_t i = 0; i < MAX_PROCESSES; i++) {
if (set->elements[i] == element) {
set->elements[i] = 0;
@@ -43,7 +44,7 @@ bool removeFromSet(Set* set, int element) {
return false; // Element is not in the set
}

bool isInSet(const Set* set, int element) {
bool isInSet(const Set* set, u32 element) {
for (size_t i = 0; i < set->size; i++) {
if (set->elements[i] == element) {
return true; // Element is in the set
@@ -54,7 +55,7 @@ bool isInSet(const Set* set, int element) {

void printSet(const Set* set) {
printf("Set: ");
for (size_t i = 0; i < set->size; i++) {
for (size_t i = 0; i < set->size; i++) {
printf("%ld ", set->elements[i]);
}
printf("\n");
6 changes: 3 additions & 3 deletions set.h
Original file line number Diff line number Diff line change
@@ -12,8 +12,8 @@ typedef struct {
} Set;

void initializeSet(Set* set);
bool addToSet(Set* set, int element);
bool removeFromSet(Set* set, int element);
bool isInSet(const Set* set, int element);
bool addToSet(Set* set, u32 element);
bool removeFromSet(Set* set, u32 element);
bool isInSet(const Set* set, u32 element);
void printSet(const Set* set);
bool isSetEmpty(const Set* set);