This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
/* | |
Return < 0 if EOF (user pressed CTRL+Z or CTRL+D) | |
Return == 0 if input fits in buffer nicely | |
Return > 0 if <return value> chars are truncated to fit buffer | |
For example, if return 2, 2 chars are truncated to fit buffer | |
*/ | |
int getss(char *psz, int bufsize) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context; | |
import android.content.res.AssetManager; | |
import android.util.Log; | |
import androidx.annotation.NonNull; | |
import java.io.File; | |
import java.io.FileOutputStream; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.OutputStream; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.os.PowerManager; | |
import androidx.annotation.NonNull; | |
public class WakeScreen { | |
/** | |
* Wake device screen as if user pressed power button. No force always on. | |
*/ | |
public static void wakeScreen(@NonNull PowerManager powerManager, | |
@NonNull String randomTag) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NOT FINISH YET | |
#include <Windows.h> | |
#include <tchar.h> | |
#include <ShlObj.h> | |
#include <ShlGuid.h> | |
bool CreateLnkShortcut(LPCTSTR szLnkPath, LPCTSTR szTargetPath) { | |
bool ret = false; | |
HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Must compile using Unicode character set; | |
// IFileDialog doesn't support non-Unicode. | |
// I'm using TCHAR because I'm get used to it. | |
#include <Windows.h> | |
#include <tchar.h> | |
#include <ShlObj.h> | |
#include <ShlGuid.h> | |
#include <strsafe.h> // StringCchCopy is better than _tcscpy_s in this case |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Declare Function SHChangeNotify Lib "Shell32.dll" (ByVal wEventID As Int32, _ | |
ByVal uFlags As Int32, ByVal dwItem1 As Int32, ByVal dwItem2 As Int32) As Int32 | |
Sub RefreshExplorer() | |
SHChangeNotify(&H8000000, &H0, 0, 0) | |
Dim CLSID_ShellApplication As New Guid("13709620-C279-11CE-A49E-444553540000") | |
Dim shellApplicationType As Type = Type.GetTypeFromCLSID(CLSID_ShellApplication, True) | |
Dim shellApplication As Object = Activator.CreateInstance(shellApplicationType) | |
Dim windows As Object = shellApplicationType.InvokeMember("Windows", _ | |
System.Reflection.BindingFlags.InvokeMethod, Nothing, shellApplication, New Object() {}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dim OSVer as String | |
Try | |
Dim Key As RegistryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows NT\CurrentVersion") | |
Dim ProductName As Object = Key.GetValue("ProductName") | |
Dim CurrentVersion As Object = Key.GetValue("CurrentVersion") | |
Dim CurrentBuildNumber As Object = Key.GetValue("CurrentBuildNumber") | |
Dim CSDVersion As Object = Key.GetValue("CSDVersion") | |
Dim BuildLabEx As Object = Key.GetValue("BuildLabEx") | |
OSVer = ProductName.ToString() | |
If CSDVersion IsNot Nothing Then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'IMPORTANT TIPS for using RijndaelManaged class | |
'The key must in 128bit or 256bit, to make 128bit key compose the MD5 hash of the Password String | |
'The mode must set to ECB, if you only want simple encryption. | |
'Must CreateEncryptor/CreateDecryptor AFTER AND ONLY AFTER you set the Key and Mode! | |
Imports System.Security.Cryptography | |
Public Class RijCrypto | |
Public Shared LastErr as String |