Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Win32 API be dangerous to my computer?

Tags:

c++

winapi

Is it possible to accidentally format the hard drive, damage the OS in some way when learning the Win32 API?

This question is an extension of the one asked here:

Can learning C or C++ be dangerous to my computer?

The reason I ask is as follows.

Stupidly, I created an array of HWNDs but looped outside of its boundaries. When I ran the program, I noticed that windows in other programs on my desktop had been closed.

I don't believe I caused any damage to the computer or any other software, but cannot be sure.

Is this, or other form of mistake in Win32 API programming, dangerous to my computer/other software on the computer?

EDIT: Apologies, when I say that windows in other programs had been closed, I should have said hidden, my loop was calling ShowWindow(..., SW_HIDE)

like image 747
will griffiths Avatar asked Dec 05 '25 04:12

will griffiths


1 Answers

It's pretty hard to do any real damage. You won't accidentally format a drive. The API calls needed to do that are pretty tricky to use. You can't call them successfully by accident.

You could pretty easily delete a bunch of files from the machine. But you'd need to be writing code that calling functions like DeleteFile to do that. In any case, so long as you have UAC enabled, the system security won't let you delete system files, or program files.

I don't think you need to worry unduly.

like image 72
David Heffernan Avatar answered Dec 07 '25 18:12

David Heffernan