托管 Flash 不会加载 swf 资源(xml、图像等)

2023-12-10

我首先尝试在我的unix机器上使用gtk2实现swf阅读器。成功了,我可以渲染简单的 swf 文件。现在,我尝试使用 xml 配置向 flash 文件添加配置、添加图像等。失败,无法通过 geturlnotify()。 这是我的代码:

#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>
#include <string.h>
#include <unistd.h>
#include <ctype.h>

#include <gtk/gtk.h> 
#include <gdk/gdkx.h>
#include "npupp.h"

#define FLASH_PLUGIN_SO "./libflashplayer.so"

void *flash_plugin_handle;

NPNetscapeFuncs browserFuncs;
NPPluginFuncs   pluginFuncs;

GtkWidget *main_window;

char* fileName = NULL;
NPStream *       stream;
const char * uagent = "Axt/1.0";

//Default window size
int WINDOW_XSIZE = 800;
int WINDOW_YSIZE = 600;

//Default child window position (flash player)
int xPosition = 0;
int yPosition = 0;

NPError (*iNP_Initialize)(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs);
NPError (*iNP_Shutdown)();
char*   (*iNP_GetMIMEDescription)();

void* loadFlashPluginSo() {
  void *handle;

  handle = dlopen(FLASH_PLUGIN_SO, RTLD_LAZY | RTLD_LOCAL);
  if(!handle) {
    fprintf(stderr, "[-] error loading libflashplayer.so: %s\n", dlerror());
    exit(1);
  } 
  fprintf(stderr,"[+] loaded libflashplayer.so\n");
  return handle;
}

void* loadSymbol(void *handle, const char *name) {
  char *error;
  void *ret;

  ret = dlsym(handle, name);

  if((error = dlerror()) != NULL) {
    fprintf(stderr, "[-] error loading symbol %s: %s\n", name, error);
    exit(1);
  } else {
    fprintf(stderr,"[+] loaded symbol %s, address: %p\n", name, ret);
  }
  return ret;
}

void loadNPEntryPoints(void *handle) {
  iNP_Initialize=loadSymbol(handle, "NP_Initialize");
  iNP_Shutdown=loadSymbol(handle, "NP_Shutdown");
  iNP_GetMIMEDescription = loadSymbol(handle,"NP_GetMIMEDescription");
}

void printPluginEntrypoints(NPPluginFuncs* pFuncs) {
  fprintf(stderr,"[*] NPP struct:\n");
  fprintf(stderr,"\t- NPP_size:                 %8d\n",pFuncs->size);
  fprintf(stderr,"\t- NPP_version:              %8d\n",pFuncs->version);
  fprintf(stderr,"\t- NPP_NewProcPtr:           %p\n", pFuncs->newp);
  fprintf(stderr,"\t- NPP_DestroyProcPtr:       %p\n", pFuncs->destroy);
  fprintf(stderr,"\t- NPP_SetWindowProcPtr:     %p\n", pFuncs->setwindow);
  fprintf(stderr,"\t- NPP_NewStreamProcPtr:     %p\n", pFuncs->newstream);
  fprintf(stderr,"\t- NPP_DestroyStreamProcPtr: %p\n", pFuncs->destroystream);
  fprintf(stderr,"\t- NPP_StreamAsFileProcPtr:  %p\n", pFuncs->asfile);
  fprintf(stderr,"\t- NPP_WriteReadyProcPtr:    %p\n", pFuncs->writeready);
  fprintf(stderr,"\t- NPP_WriteProcPtr:         %p\n", pFuncs->write);
  fprintf(stderr,"\t- NPP_PrintProcPtr:         %p\n", pFuncs->print);
  fprintf(stderr,"\t- NPP_HandleEventProcPtr:   %p\n", pFuncs->event);
  fprintf(stderr,"\t- NPP_URLNotifyProcPtr:     %p\n", pFuncs->urlnotify);
  fprintf(stderr,"\t- javaClass:                %p\n", pFuncs->javaClass);
  fprintf(stderr,"\t- NPP_GetValueProcPtr:      %p\n", pFuncs->getvalue);
  fprintf(stderr,"\t- NPP_SetValueProcPtr:      %p\n", pFuncs->setvalue);
}

NPError NPN_GetValueProc(NPP instance, NPNVariable variable, void *ret_value) {
    fprintf(stderr,"[D] NPN_GetValueProc instance:%p, variable:%d, abi_mask:%d\n", instance, variable, 0);

    switch (variable) {
    case NPNVSupportsXEmbedBool:
      *((int*)ret_value)= PR_TRUE;
      break;
    //Unix and solaris fix
    case NPNVToolkit:
      *((int*)ret_value)= NPNVGtk2;
      break;
    case NPNVnetscapeWindow:
      *((int*)ret_value)= PR_TRUE;
      break;
    default:
      *((int*)ret_value)=PR_FALSE;
      break;
    }
    return NPERR_NO_ERROR;
}

const char* NPN_UserAgentProc(NPP instance) {
    fprintf(stderr,"[D] NPN_UserAgentProc instance:%p\n", instance);
    return uagent;
}

NPError NPN_GetURLProc(NPP instance, const char* url, const char* window) {
    fprintf(stderr,"[D] NPN_GetURLProcPtr:%p, url: %s, window: %s\n", instance, url, window);
    return NPERR_NO_ERROR;
}

NPIdentifier NPN_GetStringIdentifierProc(const NPUTF8* name) {
    return (NPIdentifier)0x41424344; //Unique
}

static 
gboolean plug_removed_cb (GtkWidget *widget, gpointer data) {
    fprintf(stderr,"[!] plug_removed_cb\n");
    return TRUE;
}

static void
socket_unrealize_cb(GtkWidget *widget, gpointer data) {
    fprintf(stderr, "[!] socket_unrealize_cb\n");
}


static NPWindow *
npwindow_construct (GtkWidget *widget) {
  NPWindow *npwindow;
  NPSetWindowCallbackStruct *ws_info = NULL;

  GdkWindow *parent_win = widget->window;

  GtkWidget *socketWidget = gtk_socket_new();

  gtk_widget_set_parent_window(socketWidget, parent_win);
  gtk_widget_set_uposition(socketWidget, xPosition, yPosition);

  g_signal_connect(socketWidget, "plug_removed", G_CALLBACK(plug_removed_cb), NULL);
  g_signal_connect(socketWidget, "unrealize", G_CALLBACK(socket_unrealize_cb), NULL);
  g_signal_connect(socketWidget, "destroy", G_CALLBACK(gtk_widget_destroyed), &socketWidget);


  gpointer user_data = NULL;
  gdk_window_get_user_data(parent_win, &user_data);

  GtkContainer *container = GTK_CONTAINER(user_data);
  gtk_container_add(container, socketWidget);
  gtk_widget_realize(socketWidget);

  GtkAllocation new_allocation;
  new_allocation.x = 0;
  new_allocation.y = 0;
  new_allocation.width = WINDOW_XSIZE;
  new_allocation.height = WINDOW_YSIZE;
  gtk_widget_size_allocate(socketWidget, &new_allocation);

  gtk_widget_show(socketWidget);
  gdk_flush();

  GdkNativeWindow ww = gtk_socket_get_id(GTK_SOCKET(socketWidget));
  GdkWindow *w = gdk_window_lookup(ww); 

  npwindow = malloc (sizeof (NPWindow));
  npwindow->window = (void*)(unsigned long)ww;
  npwindow->x = 0;
  npwindow->y = 0;
  npwindow->width  = WINDOW_XSIZE;
  npwindow->height = WINDOW_YSIZE;

  ws_info = malloc(sizeof (NPSetWindowCallbackStruct));
  ws_info->type = NP_SETWINDOW;
  ws_info->display = GDK_WINDOW_XDISPLAY(w);
  ws_info->colormap = GDK_COLORMAP_XCOLORMAP(gdk_drawable_get_colormap(w));
  GdkVisual* gdkVisual = gdk_drawable_get_visual(w);
  ws_info->visual = GDK_VISUAL_XVISUAL(gdkVisual);
  ws_info->depth = gdkVisual->depth;

  npwindow->ws_info = ws_info;
  npwindow->type = NPWindowTypeWindow;

  return npwindow;
}

static NPStream *
npstream_construct() {
    NPStream *stream = malloc(sizeof(NPStream));
    stream->url=fileName;
    stream->notifyData = 0x00000000;

    fprintf(stderr,"[D] NPN_StreamConstructed: %p\n", stream);

    return stream;
}

bool NPN_GetPropertyProc(NPP npp, NPObject *obj, NPIdentifier propertyName, NPVariant *result) {
    fprintf(stderr,"[D] NPN_GetPropertyProc: %p\n", result);
    result->type = NPVariantType_Object;
    result->value.objectValue= (NPObject*)1;
    return TRUE;
}


bool NPN_InvokeProc(NPP npp, NPObject* obj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result) {
    fprintf(stderr,"[D] NPN_InvokeProc: %p\n", result);
    result->type= NPVariantType_String;
    result->value.stringValue.utf8characters=fileName;
    result->value.stringValue.utf8length=strlen(fileName);
    return TRUE;
}

void NPN_ReleaseVariantValueProc(NPVariant *variant) {
}

void NPN_ReleaseObjectProc(NPObject *obj) {
}

NPObject*  NPN_CreateObjectProc(NPP npp, NPClass *aClass) {
    return (NPObject*)1;
}

NPObject*  NPN_RetainObjectProc(NPObject *obj) {
    return (NPObject*)1;
}

NPError NPN_GetURLNotifyProc(NPP instance, const char* url, const char* window, void* notifyData) {
    fprintf(stderr,"[D] NPN_GetURLNotifyProc:%p, url: %s, window: %s\n", instance, url, window);
    return 0;
}

NPN_GetURL, NPN_GetURLNotify, and NPP_URLNotify

void initNPNetscapeFuncs(NPNetscapeFuncs *bFuncs) {
  int i=0;

  for(i=1; i<sizeof(*bFuncs)/sizeof(ssize_t); i++)
    *(((ssize_t*)bFuncs)+i)=i+1000;

  bFuncs->geturl=NPN_GetURLProc;
  bFuncs->getvalue=NPN_GetValueProc;
  bFuncs->uagent=NPN_UserAgentProc;
  bFuncs->getproperty=NPN_GetPropertyProc;
  bFuncs->getstringidentifier=NPN_GetStringIdentifierProc;
  bFuncs->invoke=NPN_InvokeProc;
  bFuncs->releasevariantvalue=NPN_ReleaseVariantValueProc;
  bFuncs->releaseobject=NPN_ReleaseObjectProc;
  bFuncs->createobject=NPN_CreateObjectProc;
  bFuncs->retainobject=NPN_RetainObjectProc;
  bFuncs->geturlnotify=NPN_GetURLNotifyProc;
  bFuncs->size= sizeof(bFuncs);
  bFuncs->version= (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR;;
}

static void destroy(GtkWidget *widget, gpointer data) {
    gtk_main_quit ();
}

static void checkError(const char* str, NPError err) {
  if(err == NPERR_NO_ERROR)
    fprintf(stderr, "[+] %s: success\n", str);
  else
    fprintf(stderr, "[-] %s: failed (%d)\n", str, err);
    fflush(NULL);
}

int main(int argc, char **argv) 
{
  int c;
  extern char *optarg;

  while ((c = getopt(argc, argv, "f:w:h:x:y:")) != EOF){
    switch (c) {
      case 'f':
        fileName = optarg;
        fprintf (stderr, "[+] Filename: %s\n", optarg);
        break;
      case 'w':
        WINDOW_XSIZE = atoi(optarg);
        fprintf (stderr, "[+] WINDOW_XSIZE: %s\n", optarg);
        break;
      case 'h':
        WINDOW_YSIZE = atoi(optarg);
        fprintf (stderr, "[+] WINDOW_YSIZE: %s\n", optarg);
        break;
      case 'x':
        xPosition = atoi(optarg);
        fprintf (stderr, "[+] Position in x: %s\n", optarg);
        break;
      case 'y':
        yPosition = atoi(optarg);
        fprintf (stderr, "[+] Position in y: %s\n", optarg);
        break;
      case '?':
        if (optopt == 'f' | optopt == 'w' | optopt == 'h')
          fprintf (stderr, "[-] Option -%c requires an argument.\n", optopt);
        else if (isprint (optopt))
          fprintf (stderr, "[-] Unknown option `-%c'.\n", optopt);
        else
          fprintf (stderr,"[-] Unknown option character `\\x%x'.\n", optopt);
          exit(-1);
      default:
        fprintf(stderr,"[-] Usage: %s -f <swffile> -x <xsize> -y <ysize>\n", argv[0]);
        exit(-1);
    }
  }

  gtk_init (&argc, &argv);
  main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_widget_set_usize (main_window, WINDOW_XSIZE, WINDOW_YSIZE);
  gtk_widget_set_uposition (main_window, xPosition, yPosition);
  g_signal_connect (G_OBJECT (main_window), "destroy", G_CALLBACK (destroy), NULL);
  gtk_widget_realize(main_window);
  gtk_widget_show_all(main_window);
  fprintf(stderr,"[+] created GTK widget\n");

  flash_plugin_handle = loadFlashPluginSo();

  loadNPEntryPoints(flash_plugin_handle);
  fprintf(stderr,"[+] initialized flash plugin entry points\n");

  initNPNetscapeFuncs(&browserFuncs);
  fprintf(stderr,"[+] initialized browser functions\n");

  checkError("NP_Initialize", iNP_Initialize(&browserFuncs, &pluginFuncs));

  printPluginEntrypoints(&pluginFuncs);

  NPWindow *npwin = npwindow_construct(main_window);
  fprintf(stderr,"[+] created NPWindow widget\n");

  NPP_t *instancep = malloc(sizeof(NPP_t));
  memset(instancep,0,sizeof(sizeof(NPP_t)));
  NPP instance     = instancep;

  NPSavedData* saved = malloc(sizeof(NPSavedData));
  memset(saved,0,sizeof(sizeof(NPSavedData)));

  stream = npstream_construct();
  uint16_t stype;

  char *xargv[]= {"quality", "bgcolor", "width", "height", "allowScriptAccess", "loop" };
  char *xargm[]= {"high", "#000000", "1360", "768", "always", "false" };


  checkError("NPN_New", pluginFuncs.newp("application/x-shockwave-flash", instance, NP_EMBED, 0, xargv, xargm, saved));
  checkError("NPN_SetWindow", pluginFuncs.setwindow(instance, npwin));
  checkError("NPN_NewStream", pluginFuncs.newstream(instance, "application/x-shockwave-flash", stream, 0,  &stype));


  FILE *pp;

  char buffer[8192];
  pp = fopen(fileName,"rb");

  int len;

  while((len=fread(buffer, 1, sizeof(buffer), pp)) != 0) {
    pluginFuncs.writeready(instance, stream);
    pluginFuncs.write(instance, stream, 0, len, buffer);
  }

  fclose(pp);

  checkError("NPN_DestroyStream",pluginFuncs.destroystream(instance, stream, NPRES_DONE));

  free(stream);

  gtk_main ();

  checkError("NPN_Destroy",pluginFuncs.destroy(instance, &saved));


  checkError("NP_Shutdown", iNP_Shutdown());

  dlclose(flash_plugin_handle);
  return 0;
}

如果我加载一个没有 xml 的 swf 。有用。 当我对 xml 进行配置时。它停止了。

这是我得到的输出:

~/test-flash$ ./test-flash -f xml_sample.swf -w 400 -h 600 -x 15 -y 15
[+] Filename: xml_sample.swf
[+] WINDOW_XSIZE: 400
[+] WINDOW_YSIZE: 600
[+] Position in x: 15
[+] Position in y: 15
[+] created GTK widget
[+] loaded libflashplayer.so
[+] loaded symbol NP_Initialize, address: 0x7ff03fb634d0
[+] loaded symbol NP_Shutdown, address: 0x7ff03fb634c0
[+] loaded symbol NP_GetMIMEDescription, address: 0x7ff03fb63870
[+] initialized flash plugin entry points
[+] initialized browser functions
[+] NP_Initialize: success
[*] NPP struct:
        - NPP_size:                        0
        - NPP_version:                     0
        - NPP_NewProcPtr:           0x7ff03fb63990
        - NPP_DestroyProcPtr:       0x7ff03fb63980
        - NPP_SetWindowProcPtr:     0x7ff03fb63970
        - NPP_NewStreamProcPtr:     0x7ff03fb63960
        - NPP_DestroyStreamProcPtr: 0x7ff03fb63910
        - NPP_StreamAsFileProcPtr:  0x7ff03fb63920
        - NPP_WriteReadyProcPtr:    0x7ff03fb63950
        - NPP_WriteProcPtr:         0x7ff03fb63940
        - NPP_PrintProcPtr:         0x7ff03fb63900
        - NPP_HandleEventProcPtr:   0x7ff03fb638f0
        - NPP_URLNotifyProcPtr:     0x7ff03fb63930
        - javaClass:                (nil)
        - NPP_GetValueProcPtr:      0x7ff03fb63860
        - NPP_SetValueProcPtr:      (nil)
[+] created NPWindow widget
[D] NPN_StreamConstructed: 0x25ce5e0
[D] NPN_GetValueProc instance:0x25cc720, variable:14, abi_mask:0
[D] NPN_GetValueProc instance:0x25cc720, variable:268435469, abi_mask:0
[D] NPN_UserAgentProc instance:(nil)
[D] NPN_GetValueProc instance:0x25cc720, variable:15, abi_mask:0
[D] NPN_GetValueProc instance:0x25cc720, variable:15, abi_mask:0
[D] NPN_GetValueProc instance:0x25cc720, variable:18, abi_mask:0
[+] NPN_New: success
[D] NPN_GetValueProc instance:0x25cc720, variable:14, abi_mask:0
[+] NPN_SetWindow: success
[D] NPN_GetURLNotifyProc:0x25cc720, url: javascript:top.location+"__flashplugin_unique__", window: (null)
[D] NPN_GetValueProc instance:0x25cc720, variable:15, abi_mask:0
[+] NPN_NewStream: success
Lenght: 455
[D] NPN_UserAgentProc instance:0x25cc720
[+] NPN_DestroyStream: success
[D] NPN_GetURLNotifyProc:0x25cc720, url: sample.xml, window: (null)

谢谢你!

EDIT:

我尝试了类似的方法(代码位于 NPN_GetURLNotifyProc 函数中)。但是然后,我的应用程序冻结在我的 geturlnotifyproc 中......

NPStream s;
uint16 stype;
memset(&s,0,sizeof(NPStream));
s.url = strdup(url);
fprintf(stderr, "URL: %s\n", s.url);
checkError("NPN_NewStream", pluginFuncs.newstream(instance,"text/html",&s,0,&stype));    
    writeStream(instance, &pluginFuncs, &s);
pluginFuncs.urlnotify(instance,url,NPRES_DONE,notifyData);
checkError("NPN_DestroyStream", pluginFuncs.destroystream(instance,&s,NPRES_DONE));
            free((void*)s.url);

我忘记将通知添加到我的信息流中...

NPError NPN_GetURLNotifyProc(NPP instance, const char* url, const char* target, void* notifyData) {
    fprintf(stderr,"[D] NPN_GetURLNotifyProc:%p, url: %s, window: %s, data: %p\n", instance, url, target, notifyData);
    NPStream s;
    uint16 stype;

    memset(&s,0,sizeof(NPStream));
    s.url = strdup(url);
    s.notifyData = notifyData;

    fprintf(stderr, "NPP: %p URL: %s\n", instance, url);

    checkError("NPN_NewStream", pluginFuncs.newstream(instance,"text/html",&s,0,&stype));    
    writeStream(instance, &pluginFuncs, &s);

    checkError("NPN_DestroyStream", pluginFuncs.destroystream(instance,&s,NPRES_DONE));
    free((void*)s.url);
    pluginFuncs.urlnotify(instance, url, NPRES_DONE, notifyData);
    return 0;
}

我现在有一个独立的 gtk 应用程序,可以运行编译后的 flash (swf)。希望它对将来的人有所帮助。我建议做一个插件来读取另一个插件(又名嗅探器),以实际知道调用了哪个函数(“以及事情如何工作”),以便有一个合适的日志文件可以使用。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

托管 Flash 不会加载 swf 资源(xml、图像等) 的相关文章

  • WCF RIA 服务 - 加载多个实体

    我正在寻找一种模式来解决以下问题 我认为这很常见 我正在使用 WCF RIA 服务在初始加载时将多个实体返回给客户端 我希望两个实体异步加载 以免锁定 UI 并且我想利用 RIA 服务来执行此操作 我的解决方案如下 似乎有效 这种方法会遇到
  • GLKit的GLKMatrix“列专业”如何?

    前提A 当谈论线性存储器中的 列主 矩阵时 列被一个接一个地指定 使得存储器中的前 4 个条目对应于矩阵中的第一列 另一方面 行主 矩阵被理解为依次指定行 以便内存中的前 4 个条目指定矩阵的第一行 A GLKMatrix4看起来像这样 u
  • 在结构中使用 typedef 枚举并避免类型混合警告

    我正在使用 C99 我的编译器是 IAR Embedded workbench 但我认为这个问题对于其他一些编译器也有效 我有一个 typedef 枚举 其中包含一些项目 并且我向该新类型的结构添加了一个元素 typedef enum fo
  • 嵌套接口:将 IDictionary> 转换为 IDictionary>?

    我认为投射一个相当简单IDictionary
  • 使用实体框架模型输入安全密钥

    这是我今天的完美想法 Entity Framework 中的强类型 ID 动机 比较 ModelTypeA ID 和 ModelTypeB ID 总是 至少几乎 错误 为什么编译时不处理它 如果您使用每个请求示例 DbContext 那么很
  • 类模板参数推导 - clang 和 gcc 不同

    下面的代码使用 gcc 编译 但不使用 clang 编译 https godbolt org z ttqGuL template
  • BitTorrent 追踪器宣布问题

    我花了一点业余时间编写 BitTorrent 客户端 主要是出于好奇 但部分是出于提高我的 C 技能的愿望 我一直在使用理论维基 http wiki theory org BitTorrentSpecification作为我的向导 我已经建
  • HTTPWebResponse 响应字符串被截断

    应用程序正在与 REST 服务通信 Fiddler 显示作为 Apps 响应传入的完整良好 XML 响应 该应用程序位于法属波利尼西亚 在新西兰也有一个相同的副本 因此主要嫌疑人似乎在编码 但我们已经检查过 但空手而归 查看流读取器的输出字
  • 创建链表而不将节点声明为指针

    我已经在谷歌和一些教科书上搜索了很长一段时间 我似乎无法理解为什么在构建链表时 节点需要是指针 例如 如果我有一个节点定义为 typedef struct Node int value struct Node next Node 为什么为了
  • WCF 中 SOAP 消息的数字签名

    我在 4 0 中有一个 WCF 服务 我需要向 SOAP 响应添加数字签名 我不太确定实际上应该如何完成 我相信响应应该类似于下面的链接中显示的内容 https spaces internet2 edu display ISWG Signe
  • 如何在整个 ASP .NET MVC 应用程序中需要授权

    我创建的应用程序中 除了启用登录的操作之外的每个操作都应该超出未登录用户的限制 我应该添加 Authorize 每个班级标题前的注释 像这儿 namespace WebApplication2 Controllers Authorize p
  • 什么时候虚拟继承是一个好的设计? [复制]

    这个问题在这里已经有答案了 EDIT3 请务必在回答之前清楚地了解我要问的内容 有 EDIT2 和很多评论 有 或曾经 有很多答案清楚地表明了对问题的误解 我知道这也是我的错 对此感到抱歉 嗨 我查看了有关虚拟继承的问题 class B p
  • 覆盖子类中的字段或属性

    我有一个抽象基类 我想声明一个字段或属性 该字段或属性在从该父类继承的每个类中具有不同的值 我想在基类中定义它 以便我可以在基类方法中引用它 例如覆盖 ToString 来表示 此对象的类型为 property field 我有三种方法可以
  • 对现有视频添加水印

    我正在寻找一种用 C 在视频上加水印的方法 就像在上面写文字一样 图片或文字标签 我该怎么做 谢谢 您可以使用 Nreco 视频转换器 代码看起来像 NReco VideoConverter FFMpegConverter wrap new
  • 为什么编译时浮点计算可能不会得到与运行时计算相同的结果?

    In the speaker mentioned Compile time floating point calculations might not have the same results as runtime calculation
  • 通过指向其基址的指针删除 POD 对象是否安全?

    事实上 我正在考虑那些微不足道的可破坏物体 而不仅仅是POD http en wikipedia org wiki Plain old data structure 我不确定 POD 是否可以有基类 当我读到这个解释时is triviall
  • 如何在Xamarin中删除ViewTreeObserver?

    假设我需要获取并设置视图的高度 在 Android 中 众所周知 只有在绘制视图之后才能获取视图高度 如果您使用 Java 有很多答案 最著名的方法之一如下 取自这个答案 https stackoverflow com a 24035591
  • 是否可以在 .NET Core 中将 gRPC 与 HTTP/1.1 结合使用?

    我有两个网络服务 gRPC 客户端和 gRPC 服务器 服务器是用 NET Core编写的 然而 客户端是托管在 IIS 8 5 上的 NET Framework 4 7 2 Web 应用程序 所以它只支持HTTP 1 1 https le
  • 如何在文本框中插入图像

    有没有办法在文本框中插入图像 我正在开发一个聊天应用程序 我想用图标图像更改值 等 但我找不到如何在文本框中插入图像 Thanks 如果您使用 RichTextBox 进行聊天 请查看Paste http msdn microsoft co
  • 使用.NET技术录制屏幕视频[关闭]

    Closed 这个问题正在寻求书籍 工具 软件库等的推荐 不满足堆栈溢出指南 help closed questions 目前不接受答案 有没有一种方法可以使用 NET 技术来录制屏幕 无论是桌面还是窗口 我的目标是免费的 我喜欢小型 低

随机推荐

  • 如果特定命令失败,请勿中止脚本

    我正在运行我的脚本 bin bash eu 每当出现问题时 就会根据需要中止脚本 但有时我预计其中一个命令最终会失败 我想告诉bash忽略失败条件 在make您可以使用以下命令忽略一个命令的状态 command 有类似的东西吗bash 唯一
  • 如何将c/c++编译为ms-dos .com程序?

    我将 Code Blocks 与 GNU GCC 编译器一起使用 我的问题是 有没有办法将 c c 代码编译为 ms dos 16 位 com 可执行格式 我尝试设置构建选项并在网上搜索编译器参数 但我找不到任何东西 您当然可以将 C 和
  • 地理定位 SQL 查询未找到确切位置

    我已经测试我的地理位置查询一段时间了 直到现在我还没有发现任何问题 我试图搜索给定半径内的所有城市 通常我会使用该城市的坐标来搜索该城市周围的城市 但最近我尝试在一个城市周围搜索 发现城市本身没有返回 我的数据库中有这些城市的摘录 city
  • Java SQL 日期偏差 1 天

    我正在使用与我位于同一时区的 MySQL 服务器 我试图将 java util Date 插入数据库中的类型列DATE使用以下代码 SimpleDateFormat dateFormat new SimpleDateFormat yyyy
  • 使用鼠标在 python tkinter 画布上绘制并获取指向列表的点?

    我正在使用 tkinter 开发 Python 应用程序 我想要做的是在画布坐标上绘制 并将点记录到列表中 以便稍后进行计算 如果不可能 您会推荐任何其他可以做到这一点的工具或 GUI 平台吗 编辑 到目前为止 我拥有的是一个可以从列表中获
  • 从角色授权更改为声明授权

    我有一个使用 ASP NET 会员资格构建的 Web 表单应用程序 我成功迁移到身份 我现在想使用Claims授权而不是Roles授权 但是老用户的Role信息已经迁移到了AspNetUserRoles数据库中的表 但AspNetUserC
  • 在服务器上找不到路径错误的一部分

    我想每天运行一个调度程序 所以我创建了一个Windows application并将其存储到服务器上 这在我的本地计算机上工作正常 但我收到路径错误 找不到路径的一部分 C Windows System32 有了这个 我认为可能存在一些与路
  • @Autowired 与 JUnit 测试

    我使用了 JUnit 但有些测试存在一些问题 这些测试在 Spring bean 内有 Autowired 注释 当我引用它们时 Autowired 的 bean 始终为 NULL 这是示例代码 public class Test prot
  • 如何将矩阵的索引映射到一维数组(C++)?

    我有一个 8x8 矩阵 如下所示 char matrix 8 8 另外 我有一个包含 64 个元素的数组 如下所示 char array 64 然后我将矩阵绘制为表格 并用数字填充单元格 每个数字从左到右 从上到下递增 例如 如果我在矩阵中
  • StackOverflow 对标签弹出窗口使用什么类型的动画? [关闭]

    Closed 这个问题是无关 目前不接受答案 有谁知道 Stackoverflow 的标签弹出窗口使用什么类型的 jQuery 动画 我所说的标签弹出窗口是指当您将鼠标悬停在 Stackoveflow 中的标签上时 会出现一个弹出窗口 动画
  • 将列号转换为字母的函数?

    有谁有可以从数字返回列字母的 Excel VBA 函数吗 例如 输入100应该返回CV 此函数返回给定列号的列字母 Function Col Letter lngCol As Long As String Dim vArr vArr Spl
  • Google Sheets:自定义函数中的日期格式

    我在谷歌表格中有以下自定义函数 我尝试在自定义函数中调用内置函数 TEXT 但没有成功 Google表格会提示 未知 功能 TEXT 有解决办法吗 function NextMonth StockTradeDate var DeltaDat
  • 通用应用程序 Windows Phone 方向

    最近 我正在为 Windows Phone 和 Windows Store 开发一个通用应用程序 在该应用程序中 我试图将应用程序的方向修复为横向 但在 Windows Phone 8 1 的基于 WinRT 的应用程序中 我找不到任何方向
  • 如何在 vim cscope 结果窗口中搜索

    当我们使用 cscope 去 vim 中定义一个符号时 结果窗口中可能会显示很多候选符号 我想在窗口内进行搜索以快速找到我需要的内容 但是搜索功能 在结果窗口中似乎不起作用 只有几个键可用 j k gg G等 无论如何可以在 cscope
  • 根据正则表达式匹配对字符串列表进行排序

    我有一个看起来有点像的文本文件 random text random text can be anything blabla A blabla random text random text can be anything blabla D
  • cakephp - 如何处理完整性约束违规错误

    我在这里不知所措 我需要知道如何在违反完整性约束的情况下处理错误消息 意思是我想向用户显示一些有意义的消息 而不是显示错误消息 例如 Error SQLSTATE 23000 Integrity constraint violation 1
  • 在成员函数中测试 this 指针在 C++ 中合法吗?

    我有一个涉及不同类类型的对象的应用程序 对象由指针引用 空指针表示关联的对象不存在 目前调用代码很麻烦 因为每次使用指向对象的指针时 都会测试指针值是否为空 并采取一些适当的操作来判断是否为空 因为在不存在的情况下要采取的默认操作取决于对象
  • 如何在Sed中查找[]内的文本?

    这与已经被问过的问题类似 但是 我正在寻找 Sed 的具体答案 我有类似以下内容的文字 一些示例文本 带有一些额外的文本 foo 我需要只抓取括号内的文本 到目前为止我的尝试都是徒劳的 我可以使用其他工具解析该行 但我似乎无法让 Sed 正
  • -std=c++11 和 -std=gnu++11 有什么区别?

    两者有什么区别 std c 11 and std gnu 11作为 gcc 和 clang 的编译参数 同样的问题与c99 and gnu99 我了解 C 和 C 标准 我感兴趣的是参数的差异 我在某处读到它与某些扩展有关 但我不清楚哪些扩
  • 托管 Flash 不会加载 swf 资源(xml、图像等)

    我首先尝试在我的unix机器上使用gtk2实现swf阅读器 成功了 我可以渲染简单的 swf 文件 现在 我尝试使用 xml 配置向 flash 文件添加配置 添加图像等 失败 无法通过 geturlnotify 这是我的代码 includ