Skip to content

Instantly share code, notes, and snippets.

@melice
melice / dynacreatecom.pas
Created April 8, 2012 13:26
(Delphi)dynamic create a GUI component
procedure TForm1.Button1Click(Sender: TObject);
var
edit :TEdit;
begin
edit := TEdit.Create(nil);
edit.Parent := self;
edit.Left := random(width);
edit.Top :=random(height);
end;
@melice
melice / operatewebbrowser.txt
Created April 8, 2012 14:18
(Delphi)操作Webbrowser
如何获取 WebBrowser 对象模型的一个 HTML 框架
概要
可以使用此文章详细标准技术 WebBrowser 控件主机来访问 WebBrowser 对象模型的控件中的 HTML 页中框架窗口。 此对象模型提供对框架窗口通过 HTML 对象模型不公开额外功能。
更多信息
以下代码演示如何访问 WebBrowser 对象模型是一个 HTML 页中框架要刷新的各个框架内容。
最重要的代码使用的 HTML 文档对象 IOleContainer::EnumObjects 方法来枚举页上嵌入。 每个这些嵌入表示页上控件。 此代码通过查询每个控件对象的 IWebBrowser 2, 可以确定控件是否 sub-frame。 和 IWebBrowser 2 代表 WebBrowser 对象模型 ; 如果为该接口, QueryInterface 成功结果是对 WebBrowser 对象模型。 // Get the IDispatch of the document
LPDISPATCH lpDisp = NULL;
lpDisp = m_webBrowser.GetDocument();
@melice
melice / gist:2337560
Created April 8, 2012 14:23
反调试技术(以OD为例附核心原代码)
反调试技术(以OD为例附核心原代码)
【标 题】:反调试技术(以OD为例附核心原代码)
【作 者】:★天&緣★
【时 间】:2007-11-16 18:14
【链 接】:http://www.wgum.net/viewthread.php?tid=980
知其然,知其所以然,希望大家觉得有用,大家可以用在自己程序中查看自己的程序是否被调试..同时为了更好的了解一些游戏无法用OD调试的原因
1.程序窗口句柄检测
原理:用FindWindow函数查找具有相同窗口类名和标题的窗口,如果找到就说明有OD在运行
//********************************************
// fyttt.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include "windows.h"
#include <string>
using namespace std;
struct tagAuthResult
@melice
melice / fileexist64.pas
Created May 14, 2012 09:26
fileexist for win 64bit
function FileExists64(const FileName: string):Boolean;
type TWow64DisableWow64FsRedirection = function(var Wow64FsEnableRedirection: LongBool): LongBool; stdcall;
TWow64EnableWow64FsRedirection = function(Wow64FsEnableRedirection: LongBool): LongBool; stdcall;
var hHandle: THandle;
Wow64DisableWow64FsRedirection : TWow64DisableWow64FsRedirection;
Wow64EnableWow64FsRedirection : TWow64EnableWow64FsRedirection;
Wow64FsEnableRedirection : LongBool;
begin
hHandle := GetModuleHandle('kernel32.dll');
@melice
melice / IsWin64.pas
Created May 14, 2012 09:27
check if is windows 64bit
function IsWin64: Boolean;
var
Kernel32Handle : THandle;
IsWow64Process : function(Handle: Windows.THandle; var Res: Windows.BOOL): Windows.BOOL; stdcall;
GetNativeSystemInfo : procedure(var lpSystemInfo: TSystemInfo); stdcall;
isWoW64 : Bool;
SystemInfo : TSystemInfo;
const
PROCESSOR_ARCHITECTURE_AMD64 = 9;
PROCESSOR_ARCHITECTURE_IA64 = 6;
<?php
try {
$reqStr = getInputString();
file_put_contents(__DIR__ . '/callbackService.log', sprintf("%s BODY:%s POST:%s METHOD:%s\n",
date('Y-m-d H:i:s'), $reqStr, json_encode($_POST), $_SERVER['REQUEST_METHOD']), FILE_APPEND);
// logger.info("reqStr:" + reqStr);
if (!empty($reqStr)) {
$json = json_decode($reqStr, true);
$serviceName = $json['serviceName'];
$callPara = $json['callPara'];
procedure TfrmMain.DomImg2Image(wb:TWebBrowser);
var
i:Integer;
rang:IHTMLControlRange;
s:string;
begin
try
s := (IHTMLDocument2(wb.Document).images.item('pic',EmptyParam) as IHTMLElement).getAttribute('src',0);
rang:=((IHTMLDocument2(wb.Document).body as HTMLBody).createControlRange)as
IHTMLControlRange;
package com.ifreestudio.olympic.servlet;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@melice
melice / auto_fdisk.sh
Created January 30, 2015 07:26
阿里云自动挂载分区脚本
#/bin/bash
#########################################
#Function: auto fdisk
#Usage: bash auto_fdisk.sh
#Author: Customer service department
#Company: Alibaba Cloud Computing
#Version: 3.0
#########################################
count=0