Get the logged in Windows user name associated with a desktop

I wish to enumerate all desktops in a system and get the logged in user name for that desktop. So far I have the following code snippit as an example of obtaining a HDESK handle and trying to determine the user name associated with it (if any), but the call to LookupAccountSid fails with ERROR_NONE_MAPPED ("No mapping between account names and security IDs was done"). HDESK desk = Ope

获取与桌面关联的登录Windows用户名

我希望枚举系统中的所有桌面,并获取该桌面的登录用户名。 到目前为止,我有以下代码snippit作为获取HDESK句柄并试图确定与之关联的用户名称(如果有的话)的示例,但对LookupAccountSid的调用失败,并显示ERROR_NONE_MAPPED(“帐户名称和安全ID之间没有映射完成“)。 HDESK desk = OpenDesktop( "Default", 0, FALSE, READ_CONTROL | DESKTOP_READOBJECTS ); DWORD size = 4096; SID * sid = (SID *)malloc( size ); GetUs

How to handle NHibernate session lifetime using services?

In this question I asked about NHibernate session lifetime. I'm using a desktop application, but with client/server separation, so the conclusion is that I will use one session per server request, as the server side is where all the NHibernate magic happens. My problem now is how to handle it. I've had problems before with loading of referenced data when the session is prematurely clo

如何使用服务处理NHibernate会话生存期?

在这个问题中,我询问了关于NHibernate会话生存期。 我使用的是桌面应用程序,但是与客户机/服务器分离,所以结论是我将为每个服务器请求使用一个会话,因为服务器端是所有NHibernate魔术发生的地方。 我现在的问题是如何处理它。 当会话过早关闭时,我在加载引用数据时遇到了问题。 问题是我在调试时在被引用的类上看到以下内容 - 因此引用的数据尚未加载: base {NHibernate.HibernateException} = {“正在初始化[MyName

how to record audio and video in gstreamer

I am new to gstreamer, I want to record both audio and video save it into .mp4 format, Recording video using webcam and audio using MIC Here this is my pipeline gst-launch-1.0 -e v4l2src ! queue ! x264enc ! h264parse ! queue ! qtmux0. alsasrc ! 'audio/x-raw,rate=44100,depth=24' ! audioconvert ! audioresample ! voaacenc ! aacparse ! qtmux ! filesink location=test.mp4 When

如何在gstreamer中录制音频和视频

我是gstreamer的新手,我想录制音频和视频,将它保存为.mp4格式,使用网络摄像头和音频录制视频,使用MIC这里是我的管道 gst-launch-1.0 -e v4l2src! 队列! x264enc! h264parse! 队列! qtmux0。 alsasrc! 'audio / x-raw,rate = 44100,depth = 24'! audioconvert! audioresample! voaacenc! aacparse! qtmux! filesink location = test.mp4 当我执行它时,视频只录制10秒,甚至不录制音

How to use gstreamer to save webcam video to file?

I've been trying to get emgu to save same webcam video to file The problem is opencv only ssupports avi, and avi does not seem to suit a format like X264 very well. Could I use Gstreamer to do this for me in C? It would be good if I could choose the file format and container type too. It would be good if I could use a format like schrodinger dirac. I'm new to GStreamer so I'm

如何使用gstreamer将网络摄像头视频保存到文件?

我一直在试图让emgu将相同的摄像头视频保存到文件中 问题是opencv只支持avi,而avi似乎并不适合像X264这样的格式。 我可以使用Gstreamer在C中为我做这个吗? 如果我可以选择文件格式和容器类型,这将是一件好事。 如果我可以使用schrodinger dirac这样的格式,那将是一件好事。 我是GStreamer的新手,所以我不太确定自己是否在正确的轨道上。 编辑 我设法使用捕捉摄像头视频 gst-launch-0.10 ksvideosrc! autov

malloc implementation. Where is the pointer to the next chunk?

I am trying to understand how the malloc implementation in glibc is working. According to the source code of malloc (malloc.c in glibc 2.23) free memory chunks have the following structure. chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Size of previous chunk | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

malloc实现。 指向下一个块的指针在哪里?

我想了解glibc中的malloc实现是如何工作的。 根据malloc的源代码(glibc 2.23中的malloc.c),空闲内存块具有以下结构。 chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Size of previous chunk | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ `head:' | Size of chunk, in byt

Segmentation faulting in assignment

I'm currently learning C and I came from java. Our assignment asked us to count strings from either a file that could be added or it asks for the user to input a string. We just started using pointers and i looked up the different reasons why segmentation faults happened but I have no idea how to check for which issue it is. I initialized all my pointers to NULL but it still didn't wor

分配错误分配

我目前正在学习C,而我来自java。 我们的任务要求我们从可以添加的文件中计算字符串,或者要求用户输入字符串。 我们刚开始使用指针,并且查找了段错误发生的不同原因,但我不知道如何检查它是哪个问题。 我将所有的指针初始化为NULL,但它仍然不起作用,从我读到的这是发生分段错误的最常见原因。 #include <stdio.h> #include <stdlib.h> #include <string.h> int debug = 0; int main(int argc, char

How to know line with segmentation fault in my code?

I'm trying to learn C pointers these days, when I am trying to deal with string and pointers, and link list I am frequently getting segmentation errors. And I wasn't able to fix these issues (I can't find out the exact line where the segmentation fault is happening). My questions are: What is the tool to find the line with the segmentation fault in my code? Is there any material

如何知道我的代码中的分段错误?

我试图学习C指针这些天,当我试图处理字符串和指针,并且链接列表我经常得到分割错误。 我无法解决这些问题(我无法找到发生分段错误的确切位置)。 我的问题是: 在我的代码中找到带有分段错误的行的工具是什么? 是否有任何材料(书或教程),您可以建议我了解有关分段故障,其原因和解决方案的所有问题? gdb输出: /home/sri/Documents/projects/practice/c/strings/a.out...done. (gdb) run Starting program: /hom

Getting Segmentation Fault

I saw many questions about getting segmentation fault in C program here in SO, and I thought it would be great to have a reference to those here, a question with some cases that are causing segmentation fault. My answer is posted below. As written in some answers, the behavior is undefined for all cases, though many people meet them as segmentation fault , so this question is about what causes

分割错误

我在这里看到了许多关于在C程序中获得分段错误的问题,并且我认为能够参考这里的那些将是一件好事,这是一些导致分段错误的案例。 我的答案张贴在下面。 正如在一些答案中所写的,对于所有情况,行为都是不确定的,尽管许多人认为它们是分段错误 ,所以这个问题是关于导致这种“症状”的原因。 在下面的案例中,当我运行该程序时出现分段错误,您能确定原因吗? 1) char *str = "foo"; str[0] = 'b'; // << Segfau

C code with undefined results, compiler generates invalid code (with

I know that when you do certain things in a C program, the results are undefined. However, the compiler should not be generating invalid (machine) code, right? It would be reasonable if the code did the wrong thing, or if the code generated a segfault or something... Is this supposed to happen according to the compiler spec, or is it a bug in the compiler? Here's the (simple) program I&

具有未定义结果的C代码,编译器会生成无效代码(使用

我知道,当你在C程序中做某些事情时,结果是不确定的。 但是,编译器不应该生成无效(机器)代码,对吧? 如果代码做了错误的事情,或者代码生成了段错误或其他东西,那将是合理的...... 这是否应该根据编译器规范发生,还是编译器中的错误? 这是我正在使用的(简单)程序: int main() { char *ptr = 0; *(ptr) = 0; } 我正在编译-O3 。 那应该不会产生无效的硬件指令,对吧? 使用-O0 ,当我运行代码时,会

What is the meaning of "wild pointer" in C?

任何人都可以告诉我,在C中的野指针的含义,如何获得它,这是可用的C + +? The standard does not define or use the term "wild". I'd be careful "correcting" other people's opinions about what it means, and I'd especially avoid quoting random non-normative internet junk to support my position. To me, it would mean a pointer that neither refers to a legitimate object,

C中“野指针”的含义是什么?

任何人都可以告诉我,在C中的野指针的含义,如何获得它,这是可用的C + +? 该标准没有定义或使用术语“野生”。 我会小心地“纠正”其他人对它意味着什么的意见,我特别要避免引用随机的非规范互联网垃圾来支持我的立场。 对我来说,这意味着一个既不指向合法对象也不指NULL的指针。 这些类型的指针值的可能来源可能包括未初始化的指针对象,已不存在的对象,计算的指针值,不正确的对齐指针值,指针本身的意外损坏或指向的内容