Jump to content




Secure sleep() and read() [Un-Solved]


  • You cannot reply to this topic
4 replies to this topic

#1 Selim

  • Members
  • 189 posts
  • LocationHiding in Online Storage

Posted 11 March 2015 - 11:25 PM

So, I am making a program that I do not want ayone using being able to access the files. So, when I need to use os.pullEvent(), I use os.pullRawEvent() to stop someone from being able to Ctrl + T out of the program and wreak havoc. If I use sleep() or read(), as far as I know, they both use os.pullEvent(). How would I go about remaking sleep() and read() so that the programs that they are in cannot be terminated. Thanks!

Edited by Selim, 11 March 2015 - 11:27 PM.


#2 Quintuple Agent

  • Members
  • 107 posts
  • LocationThis page

Posted 11 March 2015 - 11:29 PM

If you have
os.pullEvent = os.pullEventRaw
near the start of your code, it will change os.pullEvent to os.pullEventRaw for all programs (until you change it back or restart the computer)
If you want to save the old pullEvent (which you should) do
local oldPull = os.pullEvent
os.pullEvent = os.pullEventRaw
That way you can do
os.pullEvent = oldPull
to change it back.

#3 HDeffo

  • Members
  • 214 posts

Posted 11 March 2015 - 11:30 PM

I believe you are not quite understanding how pullEvent and pullEventRaw work. if you call os.pullEventRaw or not when events are passed they will still go to os.pullEvent to counter this we can actually redefine the function. pullEvent and pullEventRaw are exactly the same functions with the same handling except pullEvent handles terminate events specially.

As simply put as possible this will completely override os.pullEvent and terminate
os.pullEvent = os.pullEventRaw

EDIT: ninja'd

Edited by HDeffo, 11 March 2015 - 11:31 PM.


#4 Selim

  • Members
  • 189 posts
  • LocationHiding in Online Storage

Posted 11 March 2015 - 11:30 PM

View PostQuintuple Agent, on 11 March 2015 - 11:29 PM, said:

If you have
os.pullEvent = os.pullEventRaw
near the start of your code, it will change os.pullEvent to os.pullEventRaw for all programs (until you change it back or restart the computer)
If you want to save the old pullEvent (which you should) do
local oldPull = os.pullEvent
os.pullEvent = os.pullEventRaw
That way you can do
os.pullEvent = oldPull
to change it back.
That should work, thank you!

Edited by Selim, 11 March 2015 - 11:31 PM.


#5 InDieTasten

  • Members
  • 357 posts
  • LocationGermany

Posted 11 March 2015 - 11:30 PM

if you override the os.pullEvent function with os.pullEventRaw everything works as you are intending:
os.pullEvent = os.pullEventRaw
Thats it





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users